From ad74dba0e9df59489b721d253596934bd4efbd39 Mon Sep 17 00:00:00 2001 From: Xiaogang Ding Date: Tue, 25 Nov 2025 11:53:49 +0800 Subject: [PATCH] tsp - Add test case for databox --- .../src/utils/modelUtils.ts | 2 +- .../DataBox.Management.brown/JobResource.tsp | 200 + .../back-compatible.tsp | 99 + .../DataBox.Management.brown/client.tsp | 312 + .../DataBox.Management.brown/main.tsp | 59 + .../DataBox.Management.brown/models.tsp | 4283 ++++++++++ .../preview/2021-08-01-preview/databox.json | 6013 ++++++++++++++ .../preview/2024-02-01-preview/databox.json | 7215 ++++++++++++++++ .../preview/2024-03-01-preview/databox.json | 7311 +++++++++++++++++ .../DataBox.Management.brown/readme.az.md | 12 + .../DataBox.Management.brown/readme.cli.md | 36 + .../DataBox.Management.brown/readme.go.md | 21 + .../DataBox.Management.brown/readme.java.md | 258 + .../DataBox.Management.brown/readme.md | 236 + .../DataBox.Management.brown/readme.nodejs.md | 16 + .../DataBox.Management.brown/readme.python.md | 20 + .../readme.typescript.md | 14 + .../DataBox.Management.brown/routes.tsp | 110 + .../stable/2018-01-01/databox.json | 2725 ++++++ .../stable/2019-09-01/databox.json | 4163 ++++++++++ .../stable/2020-04-01/databox.json | 4698 +++++++++++ .../stable/2020-11-01/databox.json | 4832 +++++++++++ .../stable/2021-03-01/databox.json | 5004 +++++++++++ .../stable/2021-05-01/databox.json | 5094 ++++++++++++ .../stable/2021-12-01/databox.json | 6424 +++++++++++++++ .../stable/2022-02-01/databox.json | 6527 +++++++++++++++ .../stable/2022-09-01/databox.json | 6667 +++++++++++++++ .../stable/2022-10-01/databox.json | 6800 +++++++++++++++ .../stable/2022-12-01/databox.json | 6877 ++++++++++++++++ .../stable/2023-03-01/databox.json | 7083 ++++++++++++++++ .../stable/2023-12-01/databox.json | 7210 ++++++++++++++++ .../stable/2025-02-01/databox.json | 7292 ++++++++++++++++ .../stable/2025-07-01/databox.json | 6063 ++++++++++++++ .../suppressions.yaml | 71 + .../target/.gitattributes | 0 .../target/Az.DataBox.csproj | 44 + .../target/Az.DataBox.nuspec | 32 + .../target/Az.DataBox.psm1 | 119 + .../target/MSSharedLibKey.snk | Bin .../target/Properties/AssemblyInfo.cs | 29 + .../DataBox.Management.brown/target/README.md | 24 + .../target/build-module.ps1 | 191 + .../target/check-dependencies.ps1 | 0 .../target/create-model-cmdlets.ps1 | 263 + .../target/custom/Az.DataBox.custom.psm1 | 17 + .../target/custom/README.md | 41 + .../target/docs/README.md | 11 + .../target/examples/README.md | 0 .../target/export-surface.ps1 | 41 + .../target/exports/README.md | 20 + .../target/generate-help.ps1 | 74 + .../target/generate-portal-ux.ps1 | 383 + .../target/generated/Module.cs | 200 + .../generated/api/DataBoxManagementClient.cs | 7136 ++++++++++++++++ .../AccountCredentialDetails.PowerShell.cs | 186 + .../AccountCredentialDetails.TypeConverter.cs | 145 + .../api/Models/AccountCredentialDetails.cs | 132 + .../Models/AccountCredentialDetails.json.cs | 132 + .../Models/AdditionalErrorInfo.PowerShell.cs | 158 + .../AdditionalErrorInfo.TypeConverter.cs | 145 + .../api/Models/AdditionalErrorInfo.cs | 33 + .../Models/AdditionalErrorInfo.dictionary.cs | 73 + .../api/Models/AdditionalErrorInfo.json.cs | 107 + .../Models/AdditionalErrorInfo1.PowerShell.cs | 172 + .../AdditionalErrorInfo1.TypeConverter.cs | 145 + .../api/Models/AdditionalErrorInfo1.cs | 74 + .../api/Models/AdditionalErrorInfo1.json.cs | 110 + .../AddressValidationOutput.PowerShell.cs | 234 + .../AddressValidationOutput.TypeConverter.cs | 145 + .../api/Models/AddressValidationOutput.cs | 213 + .../Models/AddressValidationOutput.json.cs | 109 + .../AddressValidationProperties.PowerShell.cs | 226 + ...dressValidationProperties.TypeConverter.cs | 145 + .../api/Models/AddressValidationProperties.cs | 146 + .../AddressValidationProperties.json.cs | 124 + .../generated/api/Models/Any.PowerShell.cs | 154 + .../generated/api/Models/Any.TypeConverter.cs | 144 + .../target/generated/api/Models/Any.cs | 32 + .../target/generated/api/Models/Any.json.cs | 102 + .../api/Models/ApiError.PowerShell.cs | 192 + .../api/Models/ApiError.TypeConverter.cs | 144 + .../target/generated/api/Models/ApiError.cs | 109 + .../generated/api/Models/ApiError.json.cs | 103 + ...pplianceNetworkConfiguration.PowerShell.cs | 170 + ...ianceNetworkConfiguration.TypeConverter.cs | 145 + .../Models/ApplianceNetworkConfiguration.cs | 78 + .../ApplianceNetworkConfiguration.json.cs | 114 + .../Models/AvailableSkuRequest.PowerShell.cs | 186 + .../AvailableSkuRequest.TypeConverter.cs | 145 + .../api/Models/AvailableSkuRequest.cs | 128 + .../api/Models/AvailableSkuRequest.json.cs | 120 + .../Models/AvailableSkusResult.PowerShell.cs | 170 + .../AvailableSkusResult.TypeConverter.cs | 145 + .../api/Models/AvailableSkusResult.cs | 75 + .../api/Models/AvailableSkusResult.json.cs | 119 + .../AzureFileFilterDetails.PowerShell.cs | 178 + .../AzureFileFilterDetails.TypeConverter.cs | 145 + .../api/Models/AzureFileFilterDetails.cs | 92 + .../api/Models/AzureFileFilterDetails.json.cs | 134 + .../Models/BlobFilterDetails.PowerShell.cs | 178 + .../Models/BlobFilterDetails.TypeConverter.cs | 145 + .../generated/api/Models/BlobFilterDetails.cs | 92 + .../api/Models/BlobFilterDetails.json.cs | 134 + .../Models/CancellationReason.PowerShell.cs | 162 + .../CancellationReason.TypeConverter.cs | 145 + .../api/Models/CancellationReason.cs | 52 + .../api/Models/CancellationReason.json.cs | 106 + .../api/Models/CloudError.PowerShell.cs | 194 + .../api/Models/CloudError.TypeConverter.cs | 144 + .../target/generated/api/Models/CloudError.cs | 138 + .../generated/api/Models/CloudError.json.cs | 134 + .../api/Models/ContactDetails.PowerShell.cs | 202 + .../Models/ContactDetails.TypeConverter.cs | 145 + .../generated/api/Models/ContactDetails.cs | 152 + .../api/Models/ContactDetails.json.cs | 132 + .../api/Models/ContactInfo.PowerShell.cs | 186 + .../api/Models/ContactInfo.TypeConverter.cs | 145 + .../generated/api/Models/ContactInfo.cs | 112 + .../generated/api/Models/ContactInfo.json.cs | 110 + .../api/Models/CopyLogDetails.PowerShell.cs | 162 + .../Models/CopyLogDetails.TypeConverter.cs | 145 + .../generated/api/Models/CopyLogDetails.cs | 54 + .../api/Models/CopyLogDetails.json.cs | 133 + .../api/Models/CopyProgress.PowerShell.cs | 330 + .../api/Models/CopyProgress.TypeConverter.cs | 145 + .../generated/api/Models/CopyProgress.cs | 552 ++ .../generated/api/Models/CopyProgress.json.cs | 195 + .../Models/CreateJobValidations.PowerShell.cs | 170 + .../CreateJobValidations.TypeConverter.cs | 145 + .../api/Models/CreateJobValidations.cs | 64 + .../api/Models/CreateJobValidations.json.cs | 106 + ...ubscriptionValidationRequest.PowerShell.cs | 183 + ...criptionValidationRequest.TypeConverter.cs | 151 + ...erLimitForSubscriptionValidationRequest.cs | 111 + ...itForSubscriptionValidationRequest.json.cs | 113 + ...ValidationResponseProperties.PowerShell.cs | 223 + ...idationResponseProperties.TypeConverter.cs | 151 + ...ubscriptionValidationResponseProperties.cs | 125 + ...iptionValidationResponseProperties.json.cs | 114 + .../CustomerDiskJobSecrets.PowerShell.cs | 250 + .../CustomerDiskJobSecrets.TypeConverter.cs | 145 + .../api/Models/CustomerDiskJobSecrets.cs | 164 + .../api/Models/CustomerDiskJobSecrets.json.cs | 124 + .../Models/DataAccountDetails.PowerShell.cs | 170 + .../DataAccountDetails.TypeConverter.cs | 145 + .../api/Models/DataAccountDetails.cs | 92 + .../api/Models/DataAccountDetails.json.cs | 129 + ...DataBoxAccountCopyLogDetails.PowerShell.cs | 186 + ...aBoxAccountCopyLogDetails.TypeConverter.cs | 145 + .../Models/DataBoxAccountCopyLogDetails.cs | 130 + .../DataBoxAccountCopyLogDetails.json.cs | 121 + ...oxCustomerDiskCopyLogDetails.PowerShell.cs | 188 + ...ustomerDiskCopyLogDetails.TypeConverter.cs | 146 + .../DataBoxCustomerDiskCopyLogDetails.cs | 124 + .../DataBoxCustomerDiskCopyLogDetails.json.cs | 121 + ...aBoxCustomerDiskCopyProgress.PowerShell.cs | 346 + ...xCustomerDiskCopyProgress.TypeConverter.cs | 146 + .../Models/DataBoxCustomerDiskCopyProgress.cs | 263 + .../DataBoxCustomerDiskCopyProgress.json.cs | 116 + ...ataBoxCustomerDiskJobDetails.PowerShell.cs | 962 +++ ...BoxCustomerDiskJobDetails.TypeConverter.cs | 145 + .../Models/DataBoxCustomerDiskJobDetails.cs | 747 ++ .../DataBoxCustomerDiskJobDetails.json.cs | 135 + ...sExportDiskDetailsCollection.PowerShell.cs | 163 + ...portDiskDetailsCollection.TypeConverter.cs | 151 + ...skJobDetailsExportDiskDetailsCollection.cs | 35 + ...sExportDiskDetailsCollection.dictionary.cs | 73 + ...DetailsExportDiskDetailsCollection.json.cs | 110 + ...sImportDiskDetailsCollection.PowerShell.cs | 163 + ...portDiskDetailsCollection.TypeConverter.cs | 151 + ...skJobDetailsImportDiskDetailsCollection.cs | 35 + ...sImportDiskDetailsCollection.dictionary.cs | 73 + ...DetailsImportDiskDetailsCollection.json.cs | 110 + .../DataBoxDiskCopyLogDetails.PowerShell.cs | 186 + ...DataBoxDiskCopyLogDetails.TypeConverter.cs | 145 + .../api/Models/DataBoxDiskCopyLogDetails.cs | 124 + .../Models/DataBoxDiskCopyLogDetails.json.cs | 121 + .../DataBoxDiskCopyProgress.PowerShell.cs | 242 + .../DataBoxDiskCopyProgress.TypeConverter.cs | 145 + .../api/Models/DataBoxDiskCopyProgress.cs | 263 + .../Models/DataBoxDiskCopyProgress.json.cs | 142 + ...oxDiskGranularCopyLogDetails.PowerShell.cs | 196 + ...iskGranularCopyLogDetails.TypeConverter.cs | 146 + .../DataBoxDiskGranularCopyLogDetails.cs | 148 + .../DataBoxDiskGranularCopyLogDetails.json.cs | 126 + ...aBoxDiskGranularCopyProgress.PowerShell.cs | 346 + ...xDiskGranularCopyProgress.TypeConverter.cs | 146 + .../Models/DataBoxDiskGranularCopyProgress.cs | 264 + .../DataBoxDiskGranularCopyProgress.json.cs | 116 + .../DataBoxDiskJobDetails.PowerShell.cs | 922 +++ .../DataBoxDiskJobDetails.TypeConverter.cs | 145 + .../api/Models/DataBoxDiskJobDetails.cs | 696 ++ .../api/Models/DataBoxDiskJobDetails.json.cs | 154 + ...obDetailsDisksAndSizeDetails.PowerShell.cs | 167 + ...etailsDisksAndSizeDetails.TypeConverter.cs | 149 + ...ataBoxDiskJobDetailsDisksAndSizeDetails.cs | 40 + ...obDetailsDisksAndSizeDetails.dictionary.cs | 73 + ...xDiskJobDetailsDisksAndSizeDetails.json.cs | 112 + ...DiskJobDetailsPreferredDisks.PowerShell.cs | 164 + ...kJobDetailsPreferredDisks.TypeConverter.cs | 147 + .../DataBoxDiskJobDetailsPreferredDisks.cs | 38 + ...DiskJobDetailsPreferredDisks.dictionary.cs | 73 + ...ataBoxDiskJobDetailsPreferredDisks.json.cs | 111 + .../DataBoxDiskJobSecrets.PowerShell.cs | 258 + .../DataBoxDiskJobSecrets.TypeConverter.cs | 145 + .../api/Models/DataBoxDiskJobSecrets.cs | 187 + .../api/Models/DataBoxDiskJobSecrets.json.cs | 129 + ...oxHeavyAccountCopyLogDetails.PowerShell.cs | 188 + ...eavyAccountCopyLogDetails.TypeConverter.cs | 146 + .../DataBoxHeavyAccountCopyLogDetails.cs | 130 + .../DataBoxHeavyAccountCopyLogDetails.json.cs | 137 + .../DataBoxHeavyJobDetails.PowerShell.cs | 890 ++ .../DataBoxHeavyJobDetails.TypeConverter.cs | 145 + .../api/Models/DataBoxHeavyJobDetails.cs | 607 ++ .../api/Models/DataBoxHeavyJobDetails.json.cs | 121 + .../DataBoxHeavyJobSecrets.PowerShell.cs | 242 + .../DataBoxHeavyJobSecrets.TypeConverter.cs | 145 + .../api/Models/DataBoxHeavyJobSecrets.cs | 141 + .../api/Models/DataBoxHeavyJobSecrets.json.cs | 119 + .../Models/DataBoxHeavySecret.PowerShell.cs | 194 + .../DataBoxHeavySecret.TypeConverter.cs | 145 + .../api/Models/DataBoxHeavySecret.cs | 147 + .../api/Models/DataBoxHeavySecret.json.cs | 145 + .../api/Models/DataBoxIdentity.PowerShell.cs | 192 + .../Models/DataBoxIdentity.TypeConverter.cs | 155 + .../generated/api/Models/DataBoxIdentity.cs | 138 + .../api/Models/DataBoxIdentity.json.cs | 113 + .../Models/DataBoxJobDetails.PowerShell.cs | 890 ++ .../Models/DataBoxJobDetails.TypeConverter.cs | 145 + .../generated/api/Models/DataBoxJobDetails.cs | 607 ++ .../api/Models/DataBoxJobDetails.json.cs | 121 + ...xScheduleAvailabilityRequest.PowerShell.cs | 188 + ...heduleAvailabilityRequest.TypeConverter.cs | 147 + .../DataBoxScheduleAvailabilityRequest.cs | 73 + ...DataBoxScheduleAvailabilityRequest.json.cs | 107 + .../api/Models/DataBoxSecret.PowerShell.cs | 194 + .../api/Models/DataBoxSecret.TypeConverter.cs | 145 + .../generated/api/Models/DataBoxSecret.cs | 147 + .../api/Models/DataBoxSecret.json.cs | 145 + .../Models/DataExportDetails.PowerShell.cs | 338 + .../Models/DataExportDetails.TypeConverter.cs | 145 + .../generated/api/Models/DataExportDetails.cs | 378 + .../api/Models/DataExportDetails.json.cs | 110 + .../Models/DataImportDetails.PowerShell.cs | 186 + .../Models/DataImportDetails.TypeConverter.cs | 145 + .../generated/api/Models/DataImportDetails.cs | 120 + .../api/Models/DataImportDetails.json.cs | 108 + ...LocationToServiceLocationMap.PowerShell.cs | 170 + ...ationToServiceLocationMap.TypeConverter.cs | 146 + .../DataLocationToServiceLocationMap.cs | 78 + .../DataLocationToServiceLocationMap.json.cs | 114 + ...sferDetailsValidationRequest.PowerShell.cs | 204 + ...rDetailsValidationRequest.TypeConverter.cs | 148 + .../DataTransferDetailsValidationRequest.cs | 171 + ...taTransferDetailsValidationRequest.json.cs | 133 + ...ValidationResponseProperties.PowerShell.cs | 223 + ...idationResponseProperties.TypeConverter.cs | 151 + ...sferDetailsValidationResponseProperties.cs | 125 + ...etailsValidationResponseProperties.json.cs | 114 + .../Models/DataboxJobSecrets.PowerShell.cs | 242 + .../Models/DataboxJobSecrets.TypeConverter.cs | 145 + .../generated/api/Models/DataboxJobSecrets.cs | 138 + .../api/Models/DataboxJobSecrets.json.cs | 116 + ...erAddressInstructionResponse.PowerShell.cs | 188 + ...ddressInstructionResponse.TypeConverter.cs | 148 + .../DatacenterAddressInstructionResponse.cs | 93 + ...tacenterAddressInstructionResponse.json.cs | 112 + ...enterAddressLocationResponse.PowerShell.cs | 284 + ...erAddressLocationResponse.TypeConverter.cs | 146 + .../DatacenterAddressLocationResponse.cs | 369 + .../DatacenterAddressLocationResponse.json.cs | 171 + .../DatacenterAddressRequest.PowerShell.cs | 178 + .../DatacenterAddressRequest.TypeConverter.cs | 145 + .../api/Models/DatacenterAddressRequest.cs | 111 + .../Models/DatacenterAddressRequest.json.cs | 110 + .../DatacenterAddressResponse.PowerShell.cs | 178 + ...DatacenterAddressResponse.TypeConverter.cs | 145 + .../api/Models/DatacenterAddressResponse.cs | 100 + .../Models/DatacenterAddressResponse.json.cs | 143 + .../Models/DcAccessSecurityCode.PowerShell.cs | 170 + .../DcAccessSecurityCode.TypeConverter.cs | 145 + .../api/Models/DcAccessSecurityCode.cs | 72 + .../api/Models/DcAccessSecurityCode.json.cs | 108 + .../api/Models/Details.PowerShell.cs | 168 + .../api/Models/Details.TypeConverter.cs | 144 + .../target/generated/api/Models/Details.cs | 69 + .../generated/api/Models/Details.json.cs | 105 + .../DeviceCapabilityDetails.PowerShell.cs | 162 + .../DeviceCapabilityDetails.TypeConverter.cs | 145 + .../api/Models/DeviceCapabilityDetails.cs | 57 + .../Models/DeviceCapabilityDetails.json.cs | 109 + .../DeviceCapabilityRequest.PowerShell.cs | 170 + .../DeviceCapabilityRequest.TypeConverter.cs | 145 + .../api/Models/DeviceCapabilityRequest.cs | 85 + .../Models/DeviceCapabilityRequest.json.cs | 108 + .../DeviceCapabilityResponse.PowerShell.cs | 162 + .../DeviceCapabilityResponse.TypeConverter.cs | 145 + .../api/Models/DeviceCapabilityResponse.cs | 55 + .../Models/DeviceCapabilityResponse.json.cs | 117 + .../Models/DeviceErasureDetails.PowerShell.cs | 180 + .../DeviceErasureDetails.TypeConverter.cs | 145 + .../api/Models/DeviceErasureDetails.cs | 107 + .../api/Models/DeviceErasureDetails.json.cs | 121 + ...kScheduleAvailabilityRequest.PowerShell.cs | 194 + ...heduleAvailabilityRequest.TypeConverter.cs | 146 + .../Models/DiskScheduleAvailabilityRequest.cs | 99 + .../DiskScheduleAvailabilityRequest.json.cs | 108 + .../api/Models/DiskSecret.PowerShell.cs | 170 + .../api/Models/DiskSecret.TypeConverter.cs | 144 + .../target/generated/api/Models/DiskSecret.cs | 78 + .../generated/api/Models/DiskSecret.json.cs | 112 + .../EncryptionPreferences.PowerShell.cs | 170 + .../EncryptionPreferences.TypeConverter.cs | 145 + .../api/Models/EncryptionPreferences.cs | 76 + .../api/Models/EncryptionPreferences.json.cs | 108 + .../api/Models/ErrorDetail.PowerShell.cs | 186 + .../api/Models/ErrorDetail.TypeConverter.cs | 145 + .../generated/api/Models/ErrorDetail.cs | 112 + .../generated/api/Models/ErrorDetail.json.cs | 118 + .../Models/ExportDiskDetails.PowerShell.cs | 178 + .../Models/ExportDiskDetails.TypeConverter.cs | 145 + .../generated/api/Models/ExportDiskDetails.cs | 101 + .../api/Models/ExportDiskDetails.json.cs | 119 + .../Models/FilterFileDetails.PowerShell.cs | 170 + .../Models/FilterFileDetails.TypeConverter.cs | 145 + .../generated/api/Models/FilterFileDetails.cs | 74 + .../api/Models/FilterFileDetails.json.cs | 108 + .../GranularCopyLogDetails.PowerShell.cs | 162 + .../GranularCopyLogDetails.TypeConverter.cs | 145 + .../api/Models/GranularCopyLogDetails.cs | 54 + .../api/Models/GranularCopyLogDetails.json.cs | 121 + .../Models/GranularCopyProgress.PowerShell.cs | 330 + .../GranularCopyProgress.TypeConverter.cs | 145 + .../api/Models/GranularCopyProgress.cs | 552 ++ .../api/Models/GranularCopyProgress.json.cs | 197 + ...yScheduleAvailabilityRequest.PowerShell.cs | 186 + ...heduleAvailabilityRequest.TypeConverter.cs | 146 + .../HeavyScheduleAvailabilityRequest.cs | 73 + .../HeavyScheduleAvailabilityRequest.json.cs | 106 + .../Models/IdentityProperties.PowerShell.cs | 178 + .../IdentityProperties.TypeConverter.cs | 145 + .../api/Models/IdentityProperties.cs | 81 + .../api/Models/IdentityProperties.json.cs | 108 + .../Models/ImportDiskDetails.PowerShell.cs | 186 + .../Models/ImportDiskDetails.TypeConverter.cs | 145 + .../generated/api/Models/ImportDiskDetails.cs | 115 + .../api/Models/ImportDiskDetails.json.cs | 115 + .../api/Models/JobDelayDetails.PowerShell.cs | 194 + .../Models/JobDelayDetails.TypeConverter.cs | 145 + .../generated/api/Models/JobDelayDetails.cs | 151 + .../api/Models/JobDelayDetails.json.cs | 129 + .../api/Models/JobDeliveryInfo.PowerShell.cs | 162 + .../Models/JobDeliveryInfo.TypeConverter.cs | 145 + .../generated/api/Models/JobDeliveryInfo.cs | 52 + .../api/Models/JobDeliveryInfo.json.cs | 106 + .../api/Models/JobDetails.PowerShell.cs | 874 ++ .../api/Models/JobDetails.TypeConverter.cs | 144 + .../target/generated/api/Models/JobDetails.cs | 1596 ++++ .../generated/api/Models/JobDetails.json.cs | 242 + .../api/Models/JobProperties.PowerShell.cs | 338 + .../api/Models/JobProperties.TypeConverter.cs | 145 + .../generated/api/Models/JobProperties.cs | 521 ++ .../api/Models/JobProperties.json.cs | 177 + .../api/Models/JobResource.PowerShell.cs | 522 ++ .../api/Models/JobResource.TypeConverter.cs | 145 + .../generated/api/Models/JobResource.cs | 759 ++ .../generated/api/Models/JobResource.json.cs | 110 + .../api/Models/JobResourceList.PowerShell.cs | 170 + .../Models/JobResourceList.TypeConverter.cs | 145 + .../generated/api/Models/JobResourceList.cs | 72 + .../api/Models/JobResourceList.json.cs | 116 + .../JobResourceUpdateParameter.PowerShell.cs | 218 + ...obResourceUpdateParameter.TypeConverter.cs | 145 + .../api/Models/JobResourceUpdateParameter.cs | 176 + .../Models/JobResourceUpdateParameter.json.cs | 110 + ...bResourceUpdateParameterTags.PowerShell.cs | 162 + ...sourceUpdateParameterTags.TypeConverter.cs | 146 + .../Models/JobResourceUpdateParameterTags.cs | 38 + ...bResourceUpdateParameterTags.dictionary.cs | 73 + .../JobResourceUpdateParameterTags.json.cs | 110 + .../api/Models/JobSecrets.PowerShell.cs | 234 + .../api/Models/JobSecrets.TypeConverter.cs | 144 + .../target/generated/api/Models/JobSecrets.cs | 218 + .../generated/api/Models/JobSecrets.json.cs | 141 + .../api/Models/JobStages.PowerShell.cs | 202 + .../api/Models/JobStages.TypeConverter.cs | 144 + .../target/generated/api/Models/JobStages.cs | 174 + .../generated/api/Models/JobStages.json.cs | 140 + .../api/Models/KeyEncryptionKey.PowerShell.cs | 210 + .../Models/KeyEncryptionKey.TypeConverter.cs | 145 + .../generated/api/Models/KeyEncryptionKey.cs | 145 + .../api/Models/KeyEncryptionKey.json.cs | 112 + .../LastMitigationActionOnJob.PowerShell.cs | 178 + ...LastMitigationActionOnJob.TypeConverter.cs | 145 + .../api/Models/LastMitigationActionOnJob.cs | 104 + .../Models/LastMitigationActionOnJob.json.cs | 110 + .../Models/ManagedDiskDetails.PowerShell.cs | 186 + .../ManagedDiskDetails.TypeConverter.cs | 145 + .../api/Models/ManagedDiskDetails.cs | 111 + .../api/Models/ManagedDiskDetails.json.cs | 110 + .../MarkDevicesShippedRequest.PowerShell.cs | 178 + ...MarkDevicesShippedRequest.TypeConverter.cs | 145 + .../api/Models/MarkDevicesShippedRequest.cs | 78 + .../Models/MarkDevicesShippedRequest.json.cs | 106 + .../Models/MitigateJobRequest.PowerShell.cs | 170 + .../MitigateJobRequest.TypeConverter.cs | 145 + .../api/Models/MitigateJobRequest.cs | 80 + .../api/Models/MitigateJobRequest.json.cs | 108 + ...lNumberCustomerResolutionMap.PowerShell.cs | 165 + ...mberCustomerResolutionMap.TypeConverter.cs | 151 + ...equestSerialNumberCustomerResolutionMap.cs | 37 + ...lNumberCustomerResolutionMap.dictionary.cs | 73 + ...tSerialNumberCustomerResolutionMap.json.cs | 112 + .../NotificationPreference.PowerShell.cs | 170 + .../NotificationPreference.TypeConverter.cs | 145 + .../api/Models/NotificationPreference.cs | 74 + .../api/Models/NotificationPreference.json.cs | 108 + .../api/Models/Operation.PowerShell.cs | 226 + .../api/Models/Operation.TypeConverter.cs | 144 + .../target/generated/api/Models/Operation.cs | 219 + .../generated/api/Models/Operation.json.cs | 124 + .../api/Models/OperationDisplay.PowerShell.cs | 186 + .../Models/OperationDisplay.TypeConverter.cs | 145 + .../generated/api/Models/OperationDisplay.cs | 112 + .../api/Models/OperationDisplay.json.cs | 112 + .../api/Models/OperationList.PowerShell.cs | 170 + .../api/Models/OperationList.TypeConverter.cs | 145 + .../generated/api/Models/OperationList.cs | 75 + .../api/Models/OperationList.json.cs | 119 + .../Models/OperationProperties.PowerShell.cs | 154 + .../OperationProperties.TypeConverter.cs | 145 + .../api/Models/OperationProperties.cs | 32 + .../api/Models/OperationProperties.json.cs | 104 + .../PackageCarrierDetails.PowerShell.cs | 178 + .../PackageCarrierDetails.TypeConverter.cs | 145 + .../api/Models/PackageCarrierDetails.cs | 92 + .../api/Models/PackageCarrierDetails.json.cs | 110 + .../Models/PackageCarrierInfo.PowerShell.cs | 170 + .../PackageCarrierInfo.TypeConverter.cs | 145 + .../api/Models/PackageCarrierInfo.cs | 72 + .../api/Models/PackageCarrierInfo.json.cs | 108 + .../PackageShippingDetails.PowerShell.cs | 178 + .../PackageShippingDetails.TypeConverter.cs | 145 + .../api/Models/PackageShippingDetails.cs | 101 + .../api/Models/PackageShippingDetails.json.cs | 119 + .../api/Models/Preferences.PowerShell.cs | 242 + .../api/Models/Preferences.TypeConverter.cs | 145 + .../generated/api/Models/Preferences.cs | 238 + .../generated/api/Models/Preferences.json.cs | 128 + ...PreferencesValidationRequest.PowerShell.cs | 274 + ...ferencesValidationRequest.TypeConverter.cs | 145 + .../Models/PreferencesValidationRequest.cs | 300 + .../PreferencesValidationRequest.json.cs | 112 + ...ValidationResponseProperties.PowerShell.cs | 223 + ...idationResponseProperties.TypeConverter.cs | 149 + ...PreferencesValidationResponseProperties.cs | 123 + ...rencesValidationResponseProperties.json.cs | 113 + .../RegionConfigurationRequest.PowerShell.cs | 274 + ...egionConfigurationRequest.TypeConverter.cs | 145 + .../api/Models/RegionConfigurationRequest.cs | 331 + .../Models/RegionConfigurationRequest.json.cs | 112 + .../RegionConfigurationResponse.PowerShell.cs | 234 + ...gionConfigurationResponse.TypeConverter.cs | 145 + .../api/Models/RegionConfigurationResponse.cs | 204 + .../RegionConfigurationResponse.json.cs | 124 + .../api/Models/Resource.PowerShell.cs | 236 + .../api/Models/Resource.TypeConverter.cs | 144 + .../target/generated/api/Models/Resource.cs | 255 + .../generated/api/Models/Resource.json.cs | 124 + .../api/Models/ResourceIdentity.PowerShell.cs | 186 + .../Models/ResourceIdentity.TypeConverter.cs | 145 + .../generated/api/Models/ResourceIdentity.cs | 118 + .../api/Models/ResourceIdentity.json.cs | 118 + ...entityUserAssignedIdentities.PowerShell.cs | 161 + ...ityUserAssignedIdentities.TypeConverter.cs | 149 + .../ResourceIdentityUserAssignedIdentities.cs | 33 + ...entityUserAssignedIdentities.dictionary.cs | 73 + ...urceIdentityUserAssignedIdentities.json.cs | 108 + .../ReverseShippingDetails.PowerShell.cs | 306 + .../ReverseShippingDetails.TypeConverter.cs | 145 + .../api/Models/ReverseShippingDetails.cs | 363 + .../api/Models/ReverseShippingDetails.json.cs | 113 + .../ScheduleAvailabilityRequest.PowerShell.cs | 186 + ...heduleAvailabilityRequest.TypeConverter.cs | 145 + .../api/Models/ScheduleAvailabilityRequest.cs | 131 + .../ScheduleAvailabilityRequest.json.cs | 135 + ...ScheduleAvailabilityResponse.PowerShell.cs | 162 + ...eduleAvailabilityResponse.TypeConverter.cs | 145 + .../Models/ScheduleAvailabilityResponse.cs | 55 + .../ScheduleAvailabilityResponse.json.cs | 117 + .../ShareCredentialDetails.PowerShell.cs | 194 + .../ShareCredentialDetails.TypeConverter.cs | 145 + .../api/Models/ShareCredentialDetails.cs | 151 + .../api/Models/ShareCredentialDetails.json.cs | 137 + .../ShipmentPickUpRequest.PowerShell.cs | 178 + .../ShipmentPickUpRequest.TypeConverter.cs | 145 + .../api/Models/ShipmentPickUpRequest.cs | 104 + .../api/Models/ShipmentPickUpRequest.json.cs | 110 + .../ShipmentPickUpResponse.PowerShell.cs | 170 + .../ShipmentPickUpResponse.TypeConverter.cs | 145 + .../api/Models/ShipmentPickUpResponse.cs | 84 + .../api/Models/ShipmentPickUpResponse.json.cs | 114 + .../api/Models/ShippingAddress.PowerShell.cs | 250 + .../Models/ShippingAddress.TypeConverter.cs | 145 + .../generated/api/Models/ShippingAddress.cs | 274 + .../api/Models/ShippingAddress.json.cs | 128 + .../generated/api/Models/Sku.PowerShell.cs | 186 + .../generated/api/Models/Sku.TypeConverter.cs | 144 + .../target/generated/api/Models/Sku.cs | 125 + .../target/generated/api/Models/Sku.json.cs | 110 + ...vailabilityValidationRequest.PowerShell.cs | 202 + ...labilityValidationRequest.TypeConverter.cs | 146 + .../SkuAvailabilityValidationRequest.cs | 183 + .../SkuAvailabilityValidationRequest.json.cs | 116 + ...ValidationResponseProperties.PowerShell.cs | 223 + ...idationResponseProperties.TypeConverter.cs | 149 + ...vailabilityValidationResponseProperties.cs | 125 + ...bilityValidationResponseProperties.json.cs | 113 + .../api/Models/SkuCapacity.PowerShell.cs | 178 + .../api/Models/SkuCapacity.TypeConverter.cs | 145 + .../generated/api/Models/SkuCapacity.cs | 101 + .../generated/api/Models/SkuCapacity.json.cs | 117 + .../api/Models/SkuCost.PowerShell.cs | 178 + .../api/Models/SkuCost.TypeConverter.cs | 144 + .../target/generated/api/Models/SkuCost.cs | 110 + .../generated/api/Models/SkuCost.json.cs | 117 + .../api/Models/SkuInformation.PowerShell.cs | 298 + .../Models/SkuInformation.TypeConverter.cs | 145 + .../generated/api/Models/SkuInformation.cs | 379 + .../api/Models/SkuInformation.json.cs | 119 + .../api/Models/SkuProperties.PowerShell.cs | 242 + .../api/Models/SkuProperties.TypeConverter.cs | 145 + .../generated/api/Models/SkuProperties.cs | 267 + .../api/Models/SkuProperties.json.cs | 176 + .../StorageAccountDetails.PowerShell.cs | 178 + .../StorageAccountDetails.TypeConverter.cs | 145 + .../api/Models/StorageAccountDetails.cs | 85 + .../api/Models/StorageAccountDetails.json.cs | 108 + ...ToCreateJobValidationRequest.PowerShell.cs | 167 + ...reateJobValidationRequest.TypeConverter.cs | 151 + ...onIsAllowedToCreateJobValidationRequest.cs | 58 + ...llowedToCreateJobValidationRequest.json.cs | 109 + ...ValidationResponseProperties.PowerShell.cs | 223 + ...idationResponseProperties.TypeConverter.cs | 151 + ...ToCreateJobValidationResponseProperties.cs | 125 + ...ateJobValidationResponseProperties.json.cs | 114 + .../api/Models/SystemData.PowerShell.cs | 202 + .../api/Models/SystemData.TypeConverter.cs | 144 + .../target/generated/api/Models/SystemData.cs | 156 + .../generated/api/Models/SystemData.json.cs | 114 + .../api/Models/TrackedResource.PowerShell.cs | 252 + .../Models/TrackedResource.TypeConverter.cs | 145 + .../generated/api/Models/TrackedResource.cs | 168 + .../api/Models/TrackedResource.json.cs | 115 + .../Models/TrackedResourceTags.PowerShell.cs | 158 + .../TrackedResourceTags.TypeConverter.cs | 145 + .../api/Models/TrackedResourceTags.cs | 33 + .../Models/TrackedResourceTags.dictionary.cs | 73 + .../api/Models/TrackedResourceTags.json.cs | 107 + .../Models/TransferAllDetails.PowerShell.cs | 178 + .../TransferAllDetails.TypeConverter.cs | 145 + .../api/Models/TransferAllDetails.cs | 94 + .../api/Models/TransferAllDetails.json.cs | 110 + .../TransferConfiguration.PowerShell.cs | 298 + .../TransferConfiguration.TypeConverter.cs | 145 + .../api/Models/TransferConfiguration.cs | 301 + .../api/Models/TransferConfiguration.json.cs | 110 + ...figurationTransferAllDetails.PowerShell.cs | 195 + ...urationTransferAllDetails.TypeConverter.cs | 149 + ...TransferConfigurationTransferAllDetails.cs | 102 + ...ferConfigurationTransferAllDetails.json.cs | 111 + ...urationTransferFilterDetails.PowerShell.cs | 251 + ...tionTransferFilterDetails.TypeConverter.cs | 149 + ...nsferConfigurationTransferFilterDetails.cs | 199 + ...ConfigurationTransferFilterDetails.json.cs | 111 + .../TransferFilterDetails.PowerShell.cs | 234 + .../TransferFilterDetails.TypeConverter.cs | 145 + .../api/Models/TransferFilterDetails.cs | 200 + .../api/Models/TransferFilterDetails.json.cs | 120 + ...TransportAvailabilityDetails.PowerShell.cs | 162 + ...nsportAvailabilityDetails.TypeConverter.cs | 145 + .../Models/TransportAvailabilityDetails.cs | 57 + .../TransportAvailabilityDetails.json.cs | 109 + ...TransportAvailabilityRequest.PowerShell.cs | 170 + ...nsportAvailabilityRequest.TypeConverter.cs | 145 + .../Models/TransportAvailabilityRequest.cs | 85 + .../TransportAvailabilityRequest.json.cs | 108 + ...ransportAvailabilityResponse.PowerShell.cs | 162 + ...sportAvailabilityResponse.TypeConverter.cs | 145 + .../Models/TransportAvailabilityResponse.cs | 55 + .../TransportAvailabilityResponse.json.cs | 117 + .../Models/TransportPreferences.PowerShell.cs | 170 + .../TransportPreferences.TypeConverter.cs | 145 + .../api/Models/TransportPreferences.cs | 83 + .../api/Models/TransportPreferences.json.cs | 111 + .../UnencryptedCredentials.PowerShell.cs | 250 + .../UnencryptedCredentials.TypeConverter.cs | 145 + .../api/Models/UnencryptedCredentials.cs | 239 + .../api/Models/UnencryptedCredentials.json.cs | 114 + .../UnencryptedCredentialsList.PowerShell.cs | 170 + ...nencryptedCredentialsList.TypeConverter.cs | 145 + .../api/Models/UnencryptedCredentialsList.cs | 72 + .../Models/UnencryptedCredentialsList.json.cs | 116 + .../api/Models/UpdateJobDetails.PowerShell.cs | 666 ++ .../Models/UpdateJobDetails.TypeConverter.cs | 145 + .../generated/api/Models/UpdateJobDetails.cs | 1053 +++ .../api/Models/UpdateJobDetails.json.cs | 116 + .../Models/UpdateJobProperties.PowerShell.cs | 162 + .../UpdateJobProperties.TypeConverter.cs | 145 + .../api/Models/UpdateJobProperties.cs | 52 + .../api/Models/UpdateJobProperties.json.cs | 106 + .../Models/UserAssignedIdentity.PowerShell.cs | 170 + .../UserAssignedIdentity.TypeConverter.cs | 145 + .../api/Models/UserAssignedIdentity.cs | 78 + .../api/Models/UserAssignedIdentity.json.cs | 114 + .../UserAssignedProperties.PowerShell.cs | 162 + .../UserAssignedProperties.TypeConverter.cs | 145 + .../api/Models/UserAssignedProperties.cs | 52 + .../api/Models/UserAssignedProperties.json.cs | 106 + .../api/Models/ValidateAddress.PowerShell.cs | 308 + .../Models/ValidateAddress.TypeConverter.cs | 145 + .../generated/api/Models/ValidateAddress.cs | 386 + .../api/Models/ValidateAddress.json.cs | 116 + .../ValidationInputRequest.PowerShell.cs | 162 + .../ValidationInputRequest.TypeConverter.cs | 145 + .../api/Models/ValidationInputRequest.cs | 54 + .../api/Models/ValidationInputRequest.json.cs | 141 + .../ValidationInputResponse.PowerShell.cs | 212 + .../ValidationInputResponse.TypeConverter.cs | 145 + .../api/Models/ValidationInputResponse.cs | 168 + .../Models/ValidationInputResponse.json.cs | 148 + .../Models/ValidationRequest.PowerShell.cs | 170 + .../Models/ValidationRequest.TypeConverter.cs | 145 + .../generated/api/Models/ValidationRequest.cs | 81 + .../api/Models/ValidationRequest.json.cs | 131 + .../Models/ValidationResponse.PowerShell.cs | 178 + .../ValidationResponse.TypeConverter.cs | 145 + .../api/Models/ValidationResponse.cs | 92 + .../api/Models/ValidationResponse.json.cs | 109 + ...ValidationResponseProperties.PowerShell.cs | 170 + ...idationResponseProperties.TypeConverter.cs | 145 + .../Models/ValidationResponseProperties.cs | 86 + .../ValidationResponseProperties.json.cs | 122 + .../GetAzDataBoxJobCredentials_List.cs | 538 ++ .../generated/cmdlets/GetAzDataBoxJob_Get.cs | 525 ++ .../cmdlets/GetAzDataBoxJob_GetViaIdentity.cs | 499 ++ .../generated/cmdlets/GetAzDataBoxJob_List.cs | 534 ++ .../cmdlets/GetAzDataBoxJob_List1.cs | 520 ++ .../cmdlets/GetAzDataBoxOperation_List.cs | 483 ++ .../GetAzDataBoxServiceAvailableSku_List.cs | 551 ++ ...DataBoxServiceAvailableSku_ListExpanded.cs | 591 ++ ...ServiceAvailableSku_ListViaJsonFilePath.cs | 553 ++ ...oxServiceAvailableSku_ListViaJsonString.cs | 551 ++ ...vokeAzDataBoxBookJobShipmentPickUp_Book.cs | 522 ++ ...taBoxBookJobShipmentPickUp_BookExpanded.cs | 548 ++ ...oxBookJobShipmentPickUp_BookViaIdentity.cs | 500 ++ ...bShipmentPickUp_BookViaIdentityExpanded.cs | 526 ++ ...okJobShipmentPickUp_BookViaJsonFilePath.cs | 524 ++ ...BookJobShipmentPickUp_BookViaJsonString.cs | 522 ++ ...nvokeAzDataBoxMarkJobDeviceShipped_Mark.cs | 509 ++ ...ataBoxMarkJobDeviceShipped_MarkExpanded.cs | 520 ++ ...BoxMarkJobDeviceShipped_MarkViaIdentity.cs | 487 ++ ...obDeviceShipped_MarkViaIdentityExpanded.cs | 498 ++ ...arkJobDeviceShipped_MarkViaJsonFilePath.cs | 511 ++ ...xMarkJobDeviceShipped_MarkViaJsonString.cs | 509 ++ .../InvokeAzDataBoxMitigate_Mitigate.cs | 509 ++ ...nvokeAzDataBoxMitigate_MitigateExpanded.cs | 524 ++ ...keAzDataBoxMitigate_MitigateViaIdentity.cs | 487 ++ ...BoxMitigate_MitigateViaIdentityExpanded.cs | 502 ++ ...DataBoxMitigate_MitigateViaJsonFilePath.cs | 511 ++ ...AzDataBoxMitigate_MitigateViaJsonString.cs | 509 ++ ...ataBoxRegionServiceConfiguration_Region.cs | 507 ++ ...taBoxRegionServiceConfiguration_Region1.cs | 521 ++ ...gionServiceConfiguration_RegionExpanded.cs | 641 ++ ...ionServiceConfiguration_RegionExpanded1.cs | 655 ++ ...nServiceConfiguration_RegionViaIdentity.cs | 498 ++ ...ServiceConfiguration_RegionViaIdentity1.cs | 502 ++ ...Configuration_RegionViaIdentityExpanded.cs | 633 ++ ...onfiguration_RegionViaIdentityExpanded1.cs | 637 ++ ...viceConfiguration_RegionViaJsonFilePath.cs | 510 ++ ...iceConfiguration_RegionViaJsonFilePath1.cs | 524 ++ ...erviceConfiguration_RegionViaJsonString.cs | 508 ++ ...rviceConfiguration_RegionViaJsonString1.cs | 522 ++ .../cmdlets/NewAzDataBoxJob_CreateExpanded.cs | 723 ++ .../NewAzDataBoxJob_CreateViaJsonFilePath.cs | 580 ++ .../NewAzDataBoxJob_CreateViaJsonString.cs | 578 ++ .../cmdlets/RemoveAzDataBoxJob_Delete.cs | 598 ++ .../RemoveAzDataBoxJob_DeleteViaIdentity.cs | 572 ++ .../cmdlets/StopAzDataBoxJob_Cancel.cs | 510 ++ .../StopAzDataBoxJob_CancelExpanded.cs | 510 ++ .../StopAzDataBoxJob_CancelViaIdentity.cs | 487 ++ ...pAzDataBoxJob_CancelViaIdentityExpanded.cs | 487 ++ .../StopAzDataBoxJob_CancelViaJsonFilePath.cs | 512 ++ .../StopAzDataBoxJob_CancelViaJsonString.cs | 510 ++ .../TestAzDataBoxServiceAddress_Validate.cs | 510 ++ ...zDataBoxServiceAddress_ValidateExpanded.cs | 683 ++ ...taBoxServiceAddress_ValidateViaIdentity.cs | 501 ++ ...viceAddress_ValidateViaIdentityExpanded.cs | 674 ++ ...xServiceAddress_ValidateViaJsonFilePath.cs | 510 ++ ...BoxServiceAddress_ValidateViaJsonString.cs | 508 ++ .../TestAzDataBoxServiceInput_Validate.cs | 505 ++ .../TestAzDataBoxServiceInput_Validate1.cs | 521 ++ ...tAzDataBoxServiceInput_ValidateExpanded.cs | 508 ++ ...AzDataBoxServiceInput_ValidateExpanded1.cs | 524 ++ ...DataBoxServiceInput_ValidateViaIdentity.cs | 496 ++ ...ataBoxServiceInput_ValidateViaIdentity1.cs | 502 ++ ...erviceInput_ValidateViaIdentityExpanded.cs | 499 ++ ...rviceInput_ValidateViaIdentityExpanded1.cs | 505 ++ ...BoxServiceInput_ValidateViaJsonFilePath.cs | 507 ++ ...oxServiceInput_ValidateViaJsonFilePath1.cs | 523 ++ ...taBoxServiceInput_ValidateViaJsonString.cs | 505 ++ ...aBoxServiceInput_ValidateViaJsonString1.cs | 521 ++ .../UpdateAzDataBoxJob_UpdateExpanded.cs | 635 ++ ...eAzDataBoxJob_UpdateViaIdentityExpanded.cs | 618 ++ ...pdateAzDataBoxJob_UpdateViaJsonFilePath.cs | 594 ++ .../UpdateAzDataBoxJob_UpdateViaJsonString.cs | 592 ++ .../generated/runtime/AsyncCommandRuntime.cs | 832 ++ .../target/generated/runtime/AsyncJob.cs | 270 + .../runtime/AsyncOperationResponse.cs | 176 + .../Attributes/ExternalDocsAttribute.cs | 30 + .../PSArgumentCompleterAttribute.cs | 52 + .../BuildTime/Cmdlets/ExportCmdletSurface.cs | 113 + .../BuildTime/Cmdlets/ExportExampleStub.cs | 74 + .../BuildTime/Cmdlets/ExportFormatPs1xml.cs | 103 + .../BuildTime/Cmdlets/ExportHelpMarkdown.cs | 56 + .../BuildTime/Cmdlets/ExportModelSurface.cs | 117 + .../BuildTime/Cmdlets/ExportProxyCmdlet.cs | 180 + .../runtime/BuildTime/Cmdlets/ExportPsd1.cs | 193 + .../BuildTime/Cmdlets/ExportTestStub.cs | 197 + .../BuildTime/Cmdlets/GetCommonParameter.cs | 52 + .../BuildTime/Cmdlets/GetModuleGuid.cs | 31 + .../BuildTime/Cmdlets/GetScriptCmdlet.cs | 54 + .../runtime/BuildTime/CollectionExtensions.cs | 20 + .../runtime/BuildTime/MarkdownRenderer.cs | 122 + .../runtime/BuildTime/Models/PsFormatTypes.cs | 138 + .../BuildTime/Models/PsHelpMarkdownOutputs.cs | 199 + .../runtime/BuildTime/Models/PsHelpTypes.cs | 211 + .../BuildTime/Models/PsMarkdownTypes.cs | 329 + .../BuildTime/Models/PsProxyOutputs.cs | 681 ++ .../runtime/BuildTime/Models/PsProxyTypes.cs | 549 ++ .../runtime/BuildTime/PsAttributes.cs | 136 + .../runtime/BuildTime/PsExtensions.cs | 176 + .../generated/runtime/BuildTime/PsHelpers.cs | 105 + .../runtime/BuildTime/StringExtensions.cs | 24 + .../runtime/BuildTime/XmlExtensions.cs | 28 + .../generated/runtime/CmdInfoHandler.cs | 40 + .../target/generated/runtime/Context.cs | 33 + .../Conversions/ConversionException.cs | 17 + .../runtime/Conversions/IJsonConverter.cs | 13 + .../Conversions/Instances/BinaryConverter.cs | 24 + .../Conversions/Instances/BooleanConverter.cs | 13 + .../Instances/DateTimeConverter.cs | 18 + .../Instances/DateTimeOffsetConverter.cs | 15 + .../Conversions/Instances/DecimalConverter.cs | 16 + .../Conversions/Instances/DoubleConverter.cs | 13 + .../Conversions/Instances/EnumConverter.cs | 30 + .../Conversions/Instances/GuidConverter.cs | 15 + .../Instances/HashSet'1Converter.cs | 27 + .../Conversions/Instances/Int16Converter.cs | 13 + .../Conversions/Instances/Int32Converter.cs | 13 + .../Conversions/Instances/Int64Converter.cs | 13 + .../Instances/JsonArrayConverter.cs | 13 + .../Instances/JsonObjectConverter.cs | 13 + .../Conversions/Instances/SingleConverter.cs | 13 + .../Conversions/Instances/StringConverter.cs | 13 + .../Instances/TimeSpanConverter.cs | 15 + .../Conversions/Instances/UInt16Converter.cs | 13 + .../Conversions/Instances/UInt32Converter.cs | 13 + .../Conversions/Instances/UInt64Converter.cs | 13 + .../Conversions/Instances/UriConverter.cs | 15 + .../runtime/Conversions/JsonConverter.cs | 21 + .../Conversions/JsonConverterAttribute.cs | 18 + .../Conversions/JsonConverterFactory.cs | 91 + .../Conversions/StringLikeConverter.cs | 45 + .../Customizations/IJsonSerializable.cs | 263 + .../runtime/Customizations/JsonArray.cs | 13 + .../runtime/Customizations/JsonBoolean.cs | 16 + .../runtime/Customizations/JsonNode.cs | 21 + .../runtime/Customizations/JsonNumber.cs | 78 + .../runtime/Customizations/JsonObject.cs | 183 + .../runtime/Customizations/JsonString.cs | 34 + .../runtime/Customizations/XNodeArray.cs | 44 + .../target/generated/runtime/Debugging.cs | 28 + .../generated/runtime/DictionaryExtensions.cs | 33 + .../target/generated/runtime/EventData.cs | 78 + .../generated/runtime/EventDataExtensions.cs | 94 + .../target/generated/runtime/EventListener.cs | 247 + .../target/generated/runtime/Events.cs | 27 + .../generated/runtime/EventsExtensions.cs | 27 + .../target/generated/runtime/Extensions.cs | 117 + .../Extensions/StringBuilderExtensions.cs | 23 + .../Helpers/Extensions/TypeExtensions.cs | 61 + .../generated/runtime/Helpers/Seperator.cs | 11 + .../generated/runtime/Helpers/TypeDetails.cs | 116 + .../generated/runtime/Helpers/XHelper.cs | 75 + .../target/generated/runtime/HttpPipeline.cs | 88 + .../generated/runtime/HttpPipelineMocking.ps1 | 110 + .../generated/runtime/IAssociativeArray.cs | 24 + .../generated/runtime/IHeaderSerializable.cs | 14 + .../target/generated/runtime/ISendAsync.cs | 413 + .../target/generated/runtime/InfoAttribute.cs | 38 + .../target/generated/runtime/InputHandler.cs | 22 + .../target/generated/runtime/Iso/IsoDate.cs | 214 + .../target/generated/runtime/JsonType.cs | 18 + .../generated/runtime/MessageAttribute.cs | 353 + .../runtime/MessageAttributeHelper.cs | 184 + .../target/generated/runtime/Method.cs | 19 + .../generated/runtime/Models/JsonMember.cs | 83 + .../generated/runtime/Models/JsonModel.cs | 89 + .../runtime/Models/JsonModelCache.cs | 19 + .../runtime/Nodes/Collections/JsonArray.cs | 65 + .../Nodes/Collections/XImmutableArray.cs | 62 + .../runtime/Nodes/Collections/XList.cs | 64 + .../runtime/Nodes/Collections/XNodeArray.cs | 73 + .../runtime/Nodes/Collections/XSet.cs | 60 + .../generated/runtime/Nodes/JsonBoolean.cs | 42 + .../generated/runtime/Nodes/JsonDate.cs | 173 + .../generated/runtime/Nodes/JsonNode.cs | 250 + .../generated/runtime/Nodes/JsonNumber.cs | 109 + .../generated/runtime/Nodes/JsonObject.cs | 172 + .../generated/runtime/Nodes/JsonString.cs | 42 + .../target/generated/runtime/Nodes/XBinary.cs | 40 + .../target/generated/runtime/Nodes/XNull.cs | 15 + .../Parser/Exceptions/ParseException.cs | 24 + .../generated/runtime/Parser/JsonParser.cs | 180 + .../generated/runtime/Parser/JsonToken.cs | 66 + .../generated/runtime/Parser/JsonTokenizer.cs | 177 + .../generated/runtime/Parser/Location.cs | 43 + .../runtime/Parser/Readers/SourceReader.cs | 130 + .../generated/runtime/Parser/TokenReader.cs | 39 + .../generated/runtime/PipelineMocking.cs | 262 + .../runtime/Properties/Resources.Designer.cs | 5655 +++++++++++++ .../runtime/Properties/Resources.resx | 0 .../target/generated/runtime/Response.cs | 27 + .../runtime/Serialization/JsonSerializer.cs | 350 + .../Serialization/PropertyTransformation.cs | 21 + .../Serialization/SerializationOptions.cs | 65 + .../generated/runtime/SerializationMode.cs | 18 + .../runtime/TypeConverterExtensions.cs | 261 + .../runtime/UndeclaredResponseException.cs | 112 + .../generated/runtime/Writers/JsonWriter.cs | 223 + .../target/generated/runtime/delegates.cs | 23 + .../DataBox.Management.brown/target/how-to.md | 58 + .../target/internal/Az.DataBox.internal.psm1 | 38 + .../target/internal/README.md | 14 + .../target/license.txt | 0 .../target/pack-module.ps1 | 0 .../target/resources/README.md | 0 .../target/run-module.ps1 | 62 + .../target/test-module.ps1 | 98 + .../target/test/README.md | 0 .../target/test/loadEnv.ps1 | 0 .../target/tools/Resources/.gitattributes | 0 .../target/tools/Resources/README.md | 0 .../Resources/custom/New-AzDeployment.ps1 | 0 .../target/tools/Resources/docs/README.md | 0 .../target/tools/Resources/examples/README.md | 0 .../target/tools/Resources/how-to.md | 0 .../target/tools/Resources/license.txt | 0 .../CmdletSurface-latest-2019-04-30.md | 0 .../tools/Resources/resources/ModelSurface.md | 0 .../tools/Resources/resources/README.md | 0 .../target/tools/Resources/test/README.md | 0 .../utils/Get-SubscriptionIdTestSafe.ps1 | 0 .../target/utils/Unprotect-SecureString.ps1 | 0 .../DataBox.Management.brown/tspconfig.yaml | 82 + .../Agent.tsp | 0 .../Endpoint.tsp | 0 .../JobDefinition.tsp | 0 .../JobRun.tsp | 0 .../Project.tsp | 0 .../StorageMover.tsp | 0 .../back-compatible.tsp | 0 .../client.tsp | 0 .../Agents_CreateOrUpdate_MaximumSet.json | 0 .../Agents_CreateOrUpdate_MinimumSet.json | 0 ...rUpdate_UploadLimitSchedule_Overnight.json | 0 .../examples/2024-07-01/Agents_Delete.json | 0 .../2024-07-01/Agents_Get_MaximumSet.json | 0 .../2024-07-01/Agents_Get_MinimumSet.json | 0 .../2024-07-01/Agents_List_MaximumSet.json | 0 .../2024-07-01/Agents_List_MinimumSet.json | 0 .../examples/2024-07-01/Agents_Update.json | 0 ...ateOrUpdate_AzureStorageBlobContainer.json | 0 ...eateOrUpdate_AzureStorageSmbFileShare.json | 0 .../Endpoints_CreateOrUpdate_NfsMount.json | 0 .../Endpoints_CreateOrUpdate_SmbMount.json | 0 .../examples/2024-07-01/Endpoints_Delete.json | 0 ...dpoints_Get_AzureStorageBlobContainer.json | 0 ...ndpoints_Get_AzureStorageSmbFileShare.json | 0 .../2024-07-01/Endpoints_Get_NfsMount.json | 0 .../2024-07-01/Endpoints_Get_SmbMount.json | 0 .../examples/2024-07-01/Endpoints_List.json | 0 ...ints_Update_AzureStorageBlobContainer.json | 0 ...oints_Update_AzureStorageSmbFileShare.json | 0 .../2024-07-01/Endpoints_Update_NfsMount.json | 0 .../2024-07-01/Endpoints_Update_SmbMount.json | 0 .../JobDefinitions_CreateOrUpdate.json | 0 .../2024-07-01/JobDefinitions_Delete.json | 0 .../2024-07-01/JobDefinitions_Get.json | 0 .../2024-07-01/JobDefinitions_List.json | 0 .../2024-07-01/JobDefinitions_StartJob.json | 0 .../2024-07-01/JobDefinitions_StopJob.json | 0 .../2024-07-01/JobDefinitions_Update.json | 0 .../examples/2024-07-01/JobRuns_Get.json | 0 .../examples/2024-07-01/JobRuns_List.json | 0 .../examples/2024-07-01/Operations_List.json | 0 .../2024-07-01/Projects_CreateOrUpdate.json | 0 .../examples/2024-07-01/Projects_Delete.json | 0 .../examples/2024-07-01/Projects_Get.json | 0 .../examples/2024-07-01/Projects_List.json | 0 .../examples/2024-07-01/Projects_Update.json | 0 .../StorageMovers_CreateOrUpdate.json | 0 .../2024-07-01/StorageMovers_Delete.json | 0 .../2024-07-01/StorageMovers_Get.json | 0 .../2024-07-01/StorageMovers_List.json | 0 .../StorageMovers_ListBySubscription.json | 0 .../2024-07-01/StorageMovers_Update.json | 0 .../Agents_CreateOrUpdate_MaximumSet.json | 0 .../Agents_CreateOrUpdate_MinimumSet.json | 0 ...rUpdate_UploadLimitSchedule_Overnight.json | 0 .../examples/2025-07-01/Agents_Delete.json | 0 .../2025-07-01/Agents_Get_MaximumSet.json | 0 .../2025-07-01/Agents_Get_MinimumSet.json | 0 .../2025-07-01/Agents_List_MaximumSet.json | 0 .../2025-07-01/Agents_List_MinimumSet.json | 0 .../examples/2025-07-01/Agents_Update.json | 0 ...eateOrUpdate_AzureMultiCloudConnector.json | 0 ...ateOrUpdate_AzureStorageBlobContainer.json | 0 ...eateOrUpdate_AzureStorageNfsFileShare.json | 0 ...eateOrUpdate_AzureStorageSmbFileShare.json | 0 .../Endpoints_CreateOrUpdate_NfsMount.json | 0 .../Endpoints_CreateOrUpdate_SmbMount.json | 0 .../examples/2025-07-01/Endpoints_Delete.json | 0 ...ndpoints_Get_AzureMultiCloudConnector.json | 0 ...dpoints_Get_AzureStorageBlobContainer.json | 0 ...ndpoints_Get_AzureStorageNfsFileShare.json | 0 ...ndpoints_Get_AzureStorageSmbFileShare.json | 0 .../2025-07-01/Endpoints_Get_NfsMount.json | 0 .../2025-07-01/Endpoints_Get_SmbMount.json | 0 .../examples/2025-07-01/Endpoints_List.json | 0 ...oints_Update_AzureMultiCloudConnector.json | 0 ...ints_Update_AzureStorageBlobContainer.json | 0 ...oints_Update_AzureStorageNfsFileShare.json | 0 ...oints_Update_AzureStorageSmbFileShare.json | 0 .../2025-07-01/Endpoints_Update_NfsMount.json | 0 .../2025-07-01/Endpoints_Update_SmbMount.json | 0 .../JobDefinitions_CreateOrUpdate.json | 0 ...finitions_CreateOrUpdate_CloudToCloud.json | 0 .../2025-07-01/JobDefinitions_Delete.json | 0 .../2025-07-01/JobDefinitions_Get.json | 0 .../2025-07-01/JobDefinitions_List.json | 0 .../2025-07-01/JobDefinitions_StartJob.json | 0 .../2025-07-01/JobDefinitions_StopJob.json | 0 .../2025-07-01/JobDefinitions_Update.json | 0 .../examples/2025-07-01/JobRuns_Get.json | 0 .../examples/2025-07-01/JobRuns_List.json | 0 .../examples/2025-07-01/Operations_List.json | 0 .../2025-07-01/Projects_CreateOrUpdate.json | 0 .../examples/2025-07-01/Projects_Delete.json | 0 .../examples/2025-07-01/Projects_Get.json | 0 .../examples/2025-07-01/Projects_List.json | 0 .../examples/2025-07-01/Projects_Update.json | 0 .../StorageMovers_CreateOrUpdate.json | 0 .../2025-07-01/StorageMovers_Delete.json | 0 .../2025-07-01/StorageMovers_Get.json | 0 .../2025-07-01/StorageMovers_List.json | 0 .../StorageMovers_ListBySubscription.json | 0 .../2025-07-01/StorageMovers_Update.json | 0 .../main.tsp | 0 .../models.tsp | 0 .../target/.gitattributes | 1 + .../target/Az.StorageMover.csproj | 0 .../target/Az.StorageMover.nuspec | 0 .../target/Az.StorageMover.psm1 | 0 .../target/MSSharedLibKey.snk | Bin 0 -> 160 bytes .../target/Properties/AssemblyInfo.cs | 0 .../target/README.md | 0 .../target/build-module.ps1 | 0 .../target/check-dependencies.ps1 | 65 + .../target/create-model-cmdlets.ps1 | 0 .../target/custom/Az.StorageMover.custom.psm1 | 0 .../target/custom/README.md | 0 .../target/docs/README.md | 0 .../target/examples/README.md | 11 + .../target/export-surface.ps1 | 0 .../target/exports/README.md | 0 .../target/generate-help.ps1 | 0 .../target/generate-portal-ux.ps1 | 0 .../target/generated/Module.cs | 0 .../generated/api/Models/Agent.PowerShell.cs | 0 .../api/Models/Agent.TypeConverter.cs | 0 .../target/generated/api/Models/Agent.cs | 0 .../target/generated/api/Models/Agent.json.cs | 0 .../api/Models/AgentList.PowerShell.cs | 0 .../api/Models/AgentList.TypeConverter.cs | 0 .../target/generated/api/Models/AgentList.cs | 0 .../generated/api/Models/AgentList.json.cs | 0 .../api/Models/AgentProperties.PowerShell.cs | 0 .../Models/AgentProperties.TypeConverter.cs | 0 .../generated/api/Models/AgentProperties.cs | 0 .../api/Models/AgentProperties.json.cs | 0 .../AgentPropertiesErrorDetails.PowerShell.cs | 0 ...entPropertiesErrorDetails.TypeConverter.cs | 0 .../api/Models/AgentPropertiesErrorDetails.cs | 0 .../AgentPropertiesErrorDetails.json.cs | 0 .../AgentUpdateParameters.PowerShell.cs | 0 .../AgentUpdateParameters.TypeConverter.cs | 0 .../api/Models/AgentUpdateParameters.cs | 0 .../api/Models/AgentUpdateParameters.json.cs | 0 .../AgentUpdateProperties.PowerShell.cs | 0 .../AgentUpdateProperties.TypeConverter.cs | 0 .../api/Models/AgentUpdateProperties.cs | 0 .../api/Models/AgentUpdateProperties.json.cs | 0 .../generated/api/Models/Any.PowerShell.cs | 0 .../generated/api/Models/Any.TypeConverter.cs | 0 .../target/generated/api/Models/Any.cs | 0 .../target/generated/api/Models/Any.json.cs | 0 .../AzureKeyVaultSmbCredentials.PowerShell.cs | 0 ...ureKeyVaultSmbCredentials.TypeConverter.cs | 0 .../api/Models/AzureKeyVaultSmbCredentials.cs | 0 .../AzureKeyVaultSmbCredentials.json.cs | 0 ...dConnectorEndpointProperties.PowerShell.cs | 0 ...nnectorEndpointProperties.TypeConverter.cs | 0 ...reMultiCloudConnectorEndpointProperties.cs | 0 ...tiCloudConnectorEndpointProperties.json.cs | 0 ...ctorEndpointUpdateProperties.PowerShell.cs | 0 ...rEndpointUpdateProperties.TypeConverter.cs | 0 ...iCloudConnectorEndpointUpdateProperties.cs | 0 ...dConnectorEndpointUpdateProperties.json.cs | 0 ...bContainerEndpointProperties.PowerShell.cs | 0 ...ntainerEndpointProperties.TypeConverter.cs | 0 ...eStorageBlobContainerEndpointProperties.cs | 0 ...ageBlobContainerEndpointProperties.json.cs | 0 ...inerEndpointUpdateProperties.PowerShell.cs | 0 ...rEndpointUpdateProperties.TypeConverter.cs | 0 ...geBlobContainerEndpointUpdateProperties.cs | 0 ...bContainerEndpointUpdateProperties.json.cs | 0 ...sFileShareEndpointProperties.PowerShell.cs | 0 ...leShareEndpointProperties.TypeConverter.cs | 0 ...reStorageNfsFileShareEndpointProperties.cs | 0 ...rageNfsFileShareEndpointProperties.json.cs | 0 ...hareEndpointUpdateProperties.PowerShell.cs | 0 ...eEndpointUpdateProperties.TypeConverter.cs | 0 ...ageNfsFileShareEndpointUpdateProperties.cs | 0 ...sFileShareEndpointUpdateProperties.json.cs | 0 ...bFileShareEndpointProperties.PowerShell.cs | 0 ...leShareEndpointProperties.TypeConverter.cs | 0 ...reStorageSmbFileShareEndpointProperties.cs | 0 ...rageSmbFileShareEndpointProperties.json.cs | 0 ...hareEndpointUpdateProperties.PowerShell.cs | 0 ...eEndpointUpdateProperties.TypeConverter.cs | 0 ...ageSmbFileShareEndpointUpdateProperties.cs | 0 ...bFileShareEndpointUpdateProperties.json.cs | 0 .../api/Models/Credentials.PowerShell.cs | 0 .../api/Models/Credentials.TypeConverter.cs | 0 .../generated/api/Models/Credentials.cs | 0 .../generated/api/Models/Credentials.json.cs | 0 .../api/Models/Endpoint.PowerShell.cs | 0 .../api/Models/Endpoint.TypeConverter.cs | 0 .../target/generated/api/Models/Endpoint.cs | 0 .../generated/api/Models/Endpoint.json.cs | 0 .../EndpointBaseProperties.PowerShell.cs | 0 .../EndpointBaseProperties.TypeConverter.cs | 0 .../api/Models/EndpointBaseProperties.cs | 0 .../api/Models/EndpointBaseProperties.json.cs | 0 ...EndpointBaseUpdateParameters.PowerShell.cs | 0 ...pointBaseUpdateParameters.TypeConverter.cs | 0 .../Models/EndpointBaseUpdateParameters.cs | 0 .../EndpointBaseUpdateParameters.json.cs | 0 ...EndpointBaseUpdateProperties.PowerShell.cs | 0 ...pointBaseUpdateProperties.TypeConverter.cs | 0 .../Models/EndpointBaseUpdateProperties.cs | 0 .../EndpointBaseUpdateProperties.json.cs | 0 .../api/Models/EndpointList.PowerShell.cs | 0 .../api/Models/EndpointList.TypeConverter.cs | 0 .../generated/api/Models/EndpointList.cs | 0 .../generated/api/Models/EndpointList.json.cs | 0 .../Models/ErrorAdditionalInfo.PowerShell.cs | 0 .../ErrorAdditionalInfo.TypeConverter.cs | 0 .../api/Models/ErrorAdditionalInfo.cs | 0 .../api/Models/ErrorAdditionalInfo.json.cs | 0 .../api/Models/ErrorDetail.PowerShell.cs | 0 .../api/Models/ErrorDetail.TypeConverter.cs | 0 .../generated/api/Models/ErrorDetail.cs | 0 .../generated/api/Models/ErrorDetail.json.cs | 0 .../api/Models/ErrorResponse.PowerShell.cs | 0 .../api/Models/ErrorResponse.TypeConverter.cs | 0 .../generated/api/Models/ErrorResponse.cs | 0 .../api/Models/ErrorResponse.json.cs | 0 .../api/Models/JobDefinition.PowerShell.cs | 0 .../api/Models/JobDefinition.TypeConverter.cs | 0 .../generated/api/Models/JobDefinition.cs | 0 .../api/Models/JobDefinition.json.cs | 0 .../Models/JobDefinitionList.PowerShell.cs | 0 .../Models/JobDefinitionList.TypeConverter.cs | 0 .../generated/api/Models/JobDefinitionList.cs | 0 .../api/Models/JobDefinitionList.json.cs | 0 .../JobDefinitionProperties.PowerShell.cs | 0 .../JobDefinitionProperties.TypeConverter.cs | 0 .../api/Models/JobDefinitionProperties.cs | 0 .../Models/JobDefinitionProperties.json.cs | 0 ...ionPropertiesSourceTargetMap.PowerShell.cs | 0 ...PropertiesSourceTargetMap.TypeConverter.cs | 0 .../JobDefinitionPropertiesSourceTargetMap.cs | 0 ...efinitionPropertiesSourceTargetMap.json.cs | 0 ...obDefinitionUpdateParameters.PowerShell.cs | 0 ...efinitionUpdateParameters.TypeConverter.cs | 0 .../Models/JobDefinitionUpdateParameters.cs | 0 .../JobDefinitionUpdateParameters.json.cs | 0 ...obDefinitionUpdateProperties.PowerShell.cs | 0 ...efinitionUpdateProperties.TypeConverter.cs | 0 .../Models/JobDefinitionUpdateProperties.cs | 0 .../JobDefinitionUpdateProperties.json.cs | 0 .../generated/api/Models/JobRun.PowerShell.cs | 0 .../api/Models/JobRun.TypeConverter.cs | 0 .../target/generated/api/Models/JobRun.cs | 0 .../generated/api/Models/JobRun.json.cs | 0 .../api/Models/JobRunError.PowerShell.cs | 0 .../api/Models/JobRunError.TypeConverter.cs | 0 .../generated/api/Models/JobRunError.cs | 0 .../generated/api/Models/JobRunError.json.cs | 0 .../api/Models/JobRunList.PowerShell.cs | 0 .../api/Models/JobRunList.TypeConverter.cs | 0 .../target/generated/api/Models/JobRunList.cs | 0 .../generated/api/Models/JobRunList.json.cs | 0 .../api/Models/JobRunProperties.PowerShell.cs | 0 .../Models/JobRunProperties.TypeConverter.cs | 0 .../generated/api/Models/JobRunProperties.cs | 0 .../api/Models/JobRunProperties.json.cs | 0 .../api/Models/JobRunResourceId.PowerShell.cs | 0 .../Models/JobRunResourceId.TypeConverter.cs | 0 .../generated/api/Models/JobRunResourceId.cs | 0 .../api/Models/JobRunResourceId.json.cs | 0 .../ManagedServiceIdentity.PowerShell.cs | 0 .../ManagedServiceIdentity.TypeConverter.cs | 0 .../api/Models/ManagedServiceIdentity.cs | 0 .../api/Models/ManagedServiceIdentity.json.cs | 0 ...entityUserAssignedIdentities.PowerShell.cs | 0 ...ityUserAssignedIdentities.TypeConverter.cs | 0 ...edServiceIdentityUserAssignedIdentities.cs | 0 ...entityUserAssignedIdentities.dictionary.cs | 0 ...viceIdentityUserAssignedIdentities.json.cs | 0 .../NfsMountEndpointProperties.PowerShell.cs | 0 ...fsMountEndpointProperties.TypeConverter.cs | 0 .../api/Models/NfsMountEndpointProperties.cs | 0 .../Models/NfsMountEndpointProperties.json.cs | 0 ...ountEndpointUpdateProperties.PowerShell.cs | 0 ...tEndpointUpdateProperties.TypeConverter.cs | 0 .../NfsMountEndpointUpdateProperties.cs | 0 .../NfsMountEndpointUpdateProperties.json.cs | 0 .../api/Models/Operation.PowerShell.cs | 0 .../api/Models/Operation.TypeConverter.cs | 0 .../target/generated/api/Models/Operation.cs | 0 .../generated/api/Models/Operation.json.cs | 0 .../api/Models/OperationDisplay.PowerShell.cs | 0 .../Models/OperationDisplay.TypeConverter.cs | 0 .../generated/api/Models/OperationDisplay.cs | 0 .../api/Models/OperationDisplay.json.cs | 0 .../Models/OperationListResult.PowerShell.cs | 0 .../OperationListResult.TypeConverter.cs | 0 .../api/Models/OperationListResult.cs | 0 .../api/Models/OperationListResult.json.cs | 0 .../api/Models/Project.PowerShell.cs | 0 .../api/Models/Project.TypeConverter.cs | 0 .../target/generated/api/Models/Project.cs | 0 .../generated/api/Models/Project.json.cs | 0 .../api/Models/ProjectList.PowerShell.cs | 0 .../api/Models/ProjectList.TypeConverter.cs | 0 .../generated/api/Models/ProjectList.cs | 0 .../generated/api/Models/ProjectList.json.cs | 0 .../Models/ProjectProperties.PowerShell.cs | 0 .../Models/ProjectProperties.TypeConverter.cs | 0 .../generated/api/Models/ProjectProperties.cs | 0 .../api/Models/ProjectProperties.json.cs | 0 .../ProjectUpdateParameters.PowerShell.cs | 0 .../ProjectUpdateParameters.TypeConverter.cs | 0 .../api/Models/ProjectUpdateParameters.cs | 0 .../Models/ProjectUpdateParameters.json.cs | 0 .../ProjectUpdateProperties.PowerShell.cs | 0 .../ProjectUpdateProperties.TypeConverter.cs | 0 .../api/Models/ProjectUpdateProperties.cs | 0 .../Models/ProjectUpdateProperties.json.cs | 0 .../api/Models/ProxyResource.PowerShell.cs | 0 .../api/Models/ProxyResource.TypeConverter.cs | 0 .../generated/api/Models/ProxyResource.cs | 0 .../api/Models/ProxyResource.json.cs | 0 .../api/Models/Recurrence.PowerShell.cs | 0 .../api/Models/Recurrence.TypeConverter.cs | 0 .../target/generated/api/Models/Recurrence.cs | 0 .../generated/api/Models/Recurrence.json.cs | 0 .../api/Models/Resource.PowerShell.cs | 0 .../api/Models/Resource.TypeConverter.cs | 0 .../target/generated/api/Models/Resource.cs | 0 .../generated/api/Models/Resource.json.cs | 0 .../SmbMountEndpointProperties.PowerShell.cs | 0 ...mbMountEndpointProperties.TypeConverter.cs | 0 .../api/Models/SmbMountEndpointProperties.cs | 0 .../Models/SmbMountEndpointProperties.json.cs | 0 ...ountEndpointUpdateProperties.PowerShell.cs | 0 ...tEndpointUpdateProperties.TypeConverter.cs | 0 .../SmbMountEndpointUpdateProperties.cs | 0 .../SmbMountEndpointUpdateProperties.json.cs | 0 .../api/Models/SourceEndpoint.PowerShell.cs | 0 .../Models/SourceEndpoint.TypeConverter.cs | 0 .../generated/api/Models/SourceEndpoint.cs | 0 .../api/Models/SourceEndpoint.json.cs | 0 .../SourceEndpointProperties.PowerShell.cs | 0 .../SourceEndpointProperties.TypeConverter.cs | 0 .../api/Models/SourceEndpointProperties.cs | 0 .../Models/SourceEndpointProperties.json.cs | 0 .../api/Models/SourceTargetMap.PowerShell.cs | 0 .../Models/SourceTargetMap.TypeConverter.cs | 0 .../generated/api/Models/SourceTargetMap.cs | 0 .../api/Models/SourceTargetMap.json.cs | 0 .../api/Models/StorageMover.PowerShell.cs | 0 .../api/Models/StorageMover.TypeConverter.cs | 0 .../generated/api/Models/StorageMover.cs | 0 .../generated/api/Models/StorageMover.json.cs | 0 .../Models/StorageMoverIdentity.PowerShell.cs | 0 .../StorageMoverIdentity.TypeConverter.cs | 0 .../api/Models/StorageMoverIdentity.cs | 0 .../api/Models/StorageMoverIdentity.json.cs | 0 .../api/Models/StorageMoverList.PowerShell.cs | 0 .../Models/StorageMoverList.TypeConverter.cs | 0 .../generated/api/Models/StorageMoverList.cs | 0 .../api/Models/StorageMoverList.json.cs | 0 .../StorageMoverProperties.PowerShell.cs | 0 .../StorageMoverProperties.TypeConverter.cs | 0 .../api/Models/StorageMoverProperties.cs | 0 .../api/Models/StorageMoverProperties.json.cs | 0 ...StorageMoverUpdateParameters.PowerShell.cs | 0 ...rageMoverUpdateParameters.TypeConverter.cs | 0 .../Models/StorageMoverUpdateParameters.cs | 0 .../StorageMoverUpdateParameters.json.cs | 0 ...ageMoverUpdateParametersTags.PowerShell.cs | 0 ...MoverUpdateParametersTags.TypeConverter.cs | 0 .../StorageMoverUpdateParametersTags.cs | 0 ...ageMoverUpdateParametersTags.dictionary.cs | 0 .../StorageMoverUpdateParametersTags.json.cs | 0 ...StorageMoverUpdateProperties.PowerShell.cs | 0 ...rageMoverUpdateProperties.TypeConverter.cs | 0 .../Models/StorageMoverUpdateProperties.cs | 0 .../StorageMoverUpdateProperties.json.cs | 0 .../api/Models/SystemData.PowerShell.cs | 0 .../api/Models/SystemData.TypeConverter.cs | 0 .../target/generated/api/Models/SystemData.cs | 0 .../generated/api/Models/SystemData.json.cs | 0 .../api/Models/TargetEndpoint.PowerShell.cs | 0 .../Models/TargetEndpoint.TypeConverter.cs | 0 .../generated/api/Models/TargetEndpoint.cs | 0 .../api/Models/TargetEndpoint.json.cs | 0 .../TargetEndpointProperties.PowerShell.cs | 0 .../TargetEndpointProperties.TypeConverter.cs | 0 .../api/Models/TargetEndpointProperties.cs | 0 .../Models/TargetEndpointProperties.json.cs | 0 .../generated/api/Models/Time.PowerShell.cs | 0 .../api/Models/Time.TypeConverter.cs | 0 .../target/generated/api/Models/Time.cs | 0 .../target/generated/api/Models/Time.json.cs | 0 .../api/Models/TrackedResource.PowerShell.cs | 0 .../Models/TrackedResource.TypeConverter.cs | 0 .../generated/api/Models/TrackedResource.cs | 0 .../api/Models/TrackedResource.json.cs | 0 .../Models/TrackedResourceTags.PowerShell.cs | 0 .../TrackedResourceTags.TypeConverter.cs | 0 .../api/Models/TrackedResourceTags.cs | 0 .../Models/TrackedResourceTags.dictionary.cs | 0 .../api/Models/TrackedResourceTags.json.cs | 0 .../Models/UploadLimitSchedule.PowerShell.cs | 0 .../UploadLimitSchedule.TypeConverter.cs | 0 .../api/Models/UploadLimitSchedule.cs | 0 .../api/Models/UploadLimitSchedule.json.cs | 0 .../UploadLimitWeeklyRecurrence.PowerShell.cs | 0 ...loadLimitWeeklyRecurrence.TypeConverter.cs | 0 .../api/Models/UploadLimitWeeklyRecurrence.cs | 0 .../UploadLimitWeeklyRecurrence.json.cs | 0 .../Models/UserAssignedIdentity.PowerShell.cs | 0 .../UserAssignedIdentity.TypeConverter.cs | 0 .../api/Models/UserAssignedIdentity.cs | 0 .../api/Models/UserAssignedIdentity.json.cs | 0 .../api/Models/WeeklyRecurrence.PowerShell.cs | 0 .../Models/WeeklyRecurrence.TypeConverter.cs | 0 .../generated/api/Models/WeeklyRecurrence.cs | 0 .../api/Models/WeeklyRecurrence.json.cs | 0 .../target/generated/api/StorageMover.cs | 0 .../cmdlets/GetAzStorageMoverAgent_Get.cs | 0 .../GetAzStorageMoverAgent_GetViaIdentity.cs | 0 ...geMoverAgent_GetViaIdentityStorageMover.cs | 0 .../cmdlets/GetAzStorageMoverAgent_List.cs | 0 .../cmdlets/GetAzStorageMoverEndpoint_Get.cs | 0 ...etAzStorageMoverEndpoint_GetViaIdentity.cs | 0 ...overEndpoint_GetViaIdentityStorageMover.cs | 0 .../cmdlets/GetAzStorageMoverEndpoint_List.cs | 0 .../GetAzStorageMoverJobDefinition_Get.cs | 0 ...torageMoverJobDefinition_GetViaIdentity.cs | 0 ...overJobDefinition_GetViaIdentityProject.cs | 0 ...obDefinition_GetViaIdentityStorageMover.cs | 0 .../GetAzStorageMoverJobDefinition_List.cs | 0 .../cmdlets/GetAzStorageMoverJobRun_Get.cs | 0 .../GetAzStorageMoverJobRun_GetViaIdentity.cs | 0 ...MoverJobRun_GetViaIdentityJobDefinition.cs | 0 ...torageMoverJobRun_GetViaIdentityProject.cs | 0 ...eMoverJobRun_GetViaIdentityStorageMover.cs | 0 .../cmdlets/GetAzStorageMoverJobRun_List.cs | 0 .../GetAzStorageMoverOperation_List.cs | 0 .../cmdlets/GetAzStorageMoverProject_Get.cs | 0 ...GetAzStorageMoverProject_GetViaIdentity.cs | 0 ...MoverProject_GetViaIdentityStorageMover.cs | 0 .../cmdlets/GetAzStorageMoverProject_List.cs | 0 .../cmdlets/GetAzStorageMover_Get.cs | 0 .../GetAzStorageMover_GetViaIdentity.cs | 0 .../cmdlets/GetAzStorageMover_List.cs | 0 .../cmdlets/GetAzStorageMover_List1.cs | 0 .../NewAzStorageMoverAgent_CreateExpanded.cs | 0 ...StorageMoverAgent_CreateViaJsonFilePath.cs | 0 ...AzStorageMoverAgent_CreateViaJsonString.cs | 0 ...ewAzStorageMoverEndpoint_CreateExpanded.cs | 0 ...rageMoverEndpoint_CreateViaJsonFilePath.cs | 0 ...torageMoverEndpoint_CreateViaJsonString.cs | 0 ...torageMoverJobDefinition_CreateExpanded.cs | 0 ...overJobDefinition_CreateViaJsonFilePath.cs | 0 ...eMoverJobDefinition_CreateViaJsonString.cs | 0 ...NewAzStorageMoverProject_CreateExpanded.cs | 0 ...orageMoverProject_CreateViaJsonFilePath.cs | 0 ...StorageMoverProject_CreateViaJsonString.cs | 0 .../NewAzStorageMover_CreateExpanded.cs | 0 ...NewAzStorageMover_CreateViaJsonFilePath.cs | 0 .../NewAzStorageMover_CreateViaJsonString.cs | 0 .../RemoveAzStorageMoverAgent_Delete.cs | 0 ...veAzStorageMoverAgent_DeleteViaIdentity.cs | 0 ...overAgent_DeleteViaIdentityStorageMover.cs | 0 .../RemoveAzStorageMoverEndpoint_Delete.cs | 0 ...zStorageMoverEndpoint_DeleteViaIdentity.cs | 0 ...rEndpoint_DeleteViaIdentityStorageMover.cs | 0 ...emoveAzStorageMoverJobDefinition_Delete.cs | 0 ...ageMoverJobDefinition_DeleteViaIdentity.cs | 0 ...rJobDefinition_DeleteViaIdentityProject.cs | 0 ...efinition_DeleteViaIdentityStorageMover.cs | 0 .../RemoveAzStorageMoverProject_Delete.cs | 0 ...AzStorageMoverProject_DeleteViaIdentity.cs | 0 ...erProject_DeleteViaIdentityStorageMover.cs | 0 .../cmdlets/RemoveAzStorageMover_Delete.cs | 0 .../RemoveAzStorageMover_DeleteViaIdentity.cs | 0 .../SetAzStorageMoverAgent_UpdateExpanded.cs | 0 ...StorageMoverAgent_UpdateViaJsonFilePath.cs | 0 ...AzStorageMoverAgent_UpdateViaJsonString.cs | 0 ...etAzStorageMoverEndpoint_UpdateExpanded.cs | 0 ...rageMoverEndpoint_UpdateViaJsonFilePath.cs | 0 ...torageMoverEndpoint_UpdateViaJsonString.cs | 0 ...torageMoverJobDefinition_UpdateExpanded.cs | 0 ...overJobDefinition_UpdateViaJsonFilePath.cs | 0 ...eMoverJobDefinition_UpdateViaJsonString.cs | 0 ...SetAzStorageMoverProject_UpdateExpanded.cs | 0 ...orageMoverProject_UpdateViaJsonFilePath.cs | 0 ...StorageMoverProject_UpdateViaJsonString.cs | 0 .../SetAzStorageMover_UpdateExpanded.cs | 0 ...SetAzStorageMover_UpdateViaJsonFilePath.cs | 0 .../SetAzStorageMover_UpdateViaJsonString.cs | 0 ...artAzStorageMoverJobDefinitionJob_Start.cs | 0 ...eMoverJobDefinitionJob_StartViaIdentity.cs | 0 ...obDefinitionJob_StartViaIdentityProject.cs | 0 ...initionJob_StartViaIdentityStorageMover.cs | 0 ...StopAzStorageMoverJobDefinitionJob_Stop.cs | 0 ...geMoverJobDefinitionJob_StopViaIdentity.cs | 0 ...JobDefinitionJob_StopViaIdentityProject.cs | 0 ...finitionJob_StopViaIdentityStorageMover.cs | 0 ...pdateAzStorageMoverAgent_UpdateExpanded.cs | 0 ...ageMoverAgent_UpdateViaIdentityExpanded.cs | 0 ...t_UpdateViaIdentityStorageMoverExpanded.cs | 0 ...StorageMoverAgent_UpdateViaJsonFilePath.cs | 0 ...AzStorageMoverAgent_UpdateViaJsonString.cs | 0 ...teAzStorageMoverEndpoint_UpdateExpanded.cs | 0 ...MoverEndpoint_UpdateViaIdentityExpanded.cs | 0 ...t_UpdateViaIdentityStorageMoverExpanded.cs | 0 ...torageMoverJobDefinition_UpdateExpanded.cs | 0 ...JobDefinition_UpdateViaIdentityExpanded.cs | 0 ...nition_UpdateViaIdentityProjectExpanded.cs | 0 ...n_UpdateViaIdentityStorageMoverExpanded.cs | 0 ...overJobDefinition_UpdateViaJsonFilePath.cs | 0 ...eMoverJobDefinition_UpdateViaJsonString.cs | 0 ...ateAzStorageMoverProject_UpdateExpanded.cs | 0 ...eMoverProject_UpdateViaIdentityExpanded.cs | 0 ...t_UpdateViaIdentityStorageMoverExpanded.cs | 0 ...orageMoverProject_UpdateViaJsonFilePath.cs | 0 ...StorageMoverProject_UpdateViaJsonString.cs | 0 .../UpdateAzStorageMover_UpdateExpanded.cs | 0 ...zStorageMover_UpdateViaIdentityExpanded.cs | 0 ...ateAzStorageMover_UpdateViaJsonFilePath.cs | 0 ...pdateAzStorageMover_UpdateViaJsonString.cs | 0 .../generated/runtime/AsyncCommandRuntime.cs | 0 .../target/generated/runtime/AsyncJob.cs | 0 .../runtime/AsyncOperationResponse.cs | 0 .../Attributes/ExternalDocsAttribute.cs | 0 .../PSArgumentCompleterAttribute.cs | 0 .../BuildTime/Cmdlets/ExportCmdletSurface.cs | 0 .../BuildTime/Cmdlets/ExportExampleStub.cs | 0 .../BuildTime/Cmdlets/ExportFormatPs1xml.cs | 0 .../BuildTime/Cmdlets/ExportHelpMarkdown.cs | 0 .../BuildTime/Cmdlets/ExportModelSurface.cs | 0 .../BuildTime/Cmdlets/ExportProxyCmdlet.cs | 0 .../runtime/BuildTime/Cmdlets/ExportPsd1.cs | 0 .../BuildTime/Cmdlets/ExportTestStub.cs | 0 .../BuildTime/Cmdlets/GetCommonParameter.cs | 0 .../BuildTime/Cmdlets/GetModuleGuid.cs | 0 .../BuildTime/Cmdlets/GetScriptCmdlet.cs | 0 .../runtime/BuildTime/CollectionExtensions.cs | 0 .../runtime/BuildTime/MarkdownRenderer.cs | 0 .../runtime/BuildTime/Models/PsFormatTypes.cs | 0 .../BuildTime/Models/PsHelpMarkdownOutputs.cs | 0 .../runtime/BuildTime/Models/PsHelpTypes.cs | 0 .../BuildTime/Models/PsMarkdownTypes.cs | 0 .../BuildTime/Models/PsProxyOutputs.cs | 0 .../runtime/BuildTime/Models/PsProxyTypes.cs | 0 .../runtime/BuildTime/PsAttributes.cs | 0 .../runtime/BuildTime/PsExtensions.cs | 0 .../generated/runtime/BuildTime/PsHelpers.cs | 0 .../runtime/BuildTime/StringExtensions.cs | 0 .../runtime/BuildTime/XmlExtensions.cs | 0 .../generated/runtime/CmdInfoHandler.cs | 0 .../target/generated/runtime/Context.cs | 0 .../Conversions/ConversionException.cs | 0 .../runtime/Conversions/IJsonConverter.cs | 0 .../Conversions/Instances/BinaryConverter.cs | 0 .../Conversions/Instances/BooleanConverter.cs | 0 .../Instances/DateTimeConverter.cs | 0 .../Instances/DateTimeOffsetConverter.cs | 0 .../Conversions/Instances/DecimalConverter.cs | 0 .../Conversions/Instances/DoubleConverter.cs | 0 .../Conversions/Instances/EnumConverter.cs | 0 .../Conversions/Instances/GuidConverter.cs | 0 .../Instances/HashSet'1Converter.cs | 0 .../Conversions/Instances/Int16Converter.cs | 0 .../Conversions/Instances/Int32Converter.cs | 0 .../Conversions/Instances/Int64Converter.cs | 0 .../Instances/JsonArrayConverter.cs | 0 .../Instances/JsonObjectConverter.cs | 0 .../Conversions/Instances/SingleConverter.cs | 0 .../Conversions/Instances/StringConverter.cs | 0 .../Instances/TimeSpanConverter.cs | 0 .../Conversions/Instances/UInt16Converter.cs | 0 .../Conversions/Instances/UInt32Converter.cs | 0 .../Conversions/Instances/UInt64Converter.cs | 0 .../Conversions/Instances/UriConverter.cs | 0 .../runtime/Conversions/JsonConverter.cs | 0 .../Conversions/JsonConverterAttribute.cs | 0 .../Conversions/JsonConverterFactory.cs | 0 .../Conversions/StringLikeConverter.cs | 0 .../Customizations/IJsonSerializable.cs | 0 .../runtime/Customizations/JsonArray.cs | 0 .../runtime/Customizations/JsonBoolean.cs | 0 .../runtime/Customizations/JsonNode.cs | 0 .../runtime/Customizations/JsonNumber.cs | 0 .../runtime/Customizations/JsonObject.cs | 0 .../runtime/Customizations/JsonString.cs | 0 .../runtime/Customizations/XNodeArray.cs | 0 .../target/generated/runtime/Debugging.cs | 0 .../generated/runtime/DictionaryExtensions.cs | 0 .../target/generated/runtime/EventData.cs | 0 .../generated/runtime/EventDataExtensions.cs | 0 .../target/generated/runtime/EventListener.cs | 0 .../target/generated/runtime/Events.cs | 0 .../generated/runtime/EventsExtensions.cs | 0 .../target/generated/runtime/Extensions.cs | 0 .../Extensions/StringBuilderExtensions.cs | 0 .../Helpers/Extensions/TypeExtensions.cs | 0 .../generated/runtime/Helpers/Seperator.cs | 0 .../generated/runtime/Helpers/TypeDetails.cs | 0 .../generated/runtime/Helpers/XHelper.cs | 0 .../target/generated/runtime/HttpPipeline.cs | 0 .../generated/runtime/HttpPipelineMocking.ps1 | 0 .../generated/runtime/IAssociativeArray.cs | 0 .../generated/runtime/IHeaderSerializable.cs | 0 .../target/generated/runtime/ISendAsync.cs | 0 .../target/generated/runtime/InfoAttribute.cs | 0 .../target/generated/runtime/InputHandler.cs | 0 .../target/generated/runtime/Iso/IsoDate.cs | 0 .../target/generated/runtime/JsonType.cs | 0 .../generated/runtime/MessageAttribute.cs | 0 .../runtime/MessageAttributeHelper.cs | 0 .../target/generated/runtime/Method.cs | 0 .../generated/runtime/Models/JsonMember.cs | 0 .../generated/runtime/Models/JsonModel.cs | 0 .../runtime/Models/JsonModelCache.cs | 0 .../runtime/Nodes/Collections/JsonArray.cs | 0 .../Nodes/Collections/XImmutableArray.cs | 0 .../runtime/Nodes/Collections/XList.cs | 0 .../runtime/Nodes/Collections/XNodeArray.cs | 0 .../runtime/Nodes/Collections/XSet.cs | 0 .../generated/runtime/Nodes/JsonBoolean.cs | 0 .../generated/runtime/Nodes/JsonDate.cs | 0 .../generated/runtime/Nodes/JsonNode.cs | 0 .../generated/runtime/Nodes/JsonNumber.cs | 0 .../generated/runtime/Nodes/JsonObject.cs | 0 .../generated/runtime/Nodes/JsonString.cs | 0 .../target/generated/runtime/Nodes/XBinary.cs | 0 .../target/generated/runtime/Nodes/XNull.cs | 0 .../Parser/Exceptions/ParseException.cs | 0 .../generated/runtime/Parser/JsonParser.cs | 0 .../generated/runtime/Parser/JsonToken.cs | 0 .../generated/runtime/Parser/JsonTokenizer.cs | 0 .../generated/runtime/Parser/Location.cs | 0 .../runtime/Parser/Readers/SourceReader.cs | 0 .../generated/runtime/Parser/TokenReader.cs | 0 .../generated/runtime/PipelineMocking.cs | 0 .../runtime/Properties/Resources.Designer.cs | 0 .../runtime/Properties/Resources.resx | 1747 ++++ .../target/generated/runtime/Response.cs | 0 .../runtime/Serialization/JsonSerializer.cs | 0 .../Serialization/PropertyTransformation.cs | 0 .../Serialization/SerializationOptions.cs | 0 .../generated/runtime/SerializationMode.cs | 0 .../runtime/TypeConverterExtensions.cs | 0 .../runtime/UndeclaredResponseException.cs | 0 .../generated/runtime/Writers/JsonWriter.cs | 0 .../target/generated/runtime/delegates.cs | 0 .../target/how-to.md | 0 .../internal/Az.StorageMover.internal.psm1 | 0 .../target/internal/README.md | 0 .../target/license.txt | 227 + .../target/pack-module.ps1 | 17 + .../target/resources/README.md | 11 + .../target/run-module.ps1 | 0 .../target/test-module.ps1 | 0 .../target/test/README.md | 17 + .../target/test/loadEnv.ps1 | 29 + .../target/tools/Resources/.gitattributes | 1 + .../target/tools/Resources/README.md | 438 + .../Resources/custom/New-AzDeployment.ps1 | 231 + .../target/tools/Resources/docs/README.md | 11 + .../target/tools/Resources/examples/README.md | 11 + .../target/tools/Resources/how-to.md | 60 + .../target/tools/Resources/license.txt | 203 + .../CmdletSurface-latest-2019-04-30.md | 598 ++ .../tools/Resources/resources/ModelSurface.md | 1645 ++++ .../tools/Resources/resources/README.md | 11 + .../target/tools/Resources/test/README.md | 17 + .../utils/Get-SubscriptionIdTestSafe.ps1 | 7 + .../target/utils/Unprotect-SecureString.ps1 | 16 + .../tspconfig.yaml | 0 .../target/tools/Resources/.gitignore | 15 - .../tests-emitter/configuration.json | 10 +- 1542 files changed, 282731 insertions(+), 20 deletions(-) create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/JobResource.tsp create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/back-compatible.tsp create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/client.tsp create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/main.tsp create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/models.tsp create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/preview/2021-08-01-preview/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/preview/2024-02-01-preview/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/preview/2024-03-01-preview/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/readme.az.md create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/readme.cli.md create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/readme.go.md create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/readme.java.md create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/readme.md create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/readme.nodejs.md create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/readme.python.md create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/readme.typescript.md create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/routes.tsp create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2018-01-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2019-09-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2020-04-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2020-11-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2021-03-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2021-05-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2021-12-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-02-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-09-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-10-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-12-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2023-03-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2023-12-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2025-02-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2025-07-01/databox.json create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/suppressions.yaml rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/.gitattributes (100%) create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/Az.DataBox.csproj create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/Az.DataBox.nuspec create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/Az.DataBox.psm1 rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/MSSharedLibKey.snk (100%) create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/Properties/AssemblyInfo.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/README.md create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/build-module.ps1 rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/check-dependencies.ps1 (100%) create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/create-model-cmdlets.ps1 create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/custom/Az.DataBox.custom.psm1 create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/custom/README.md create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/docs/README.md rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/examples/README.md (100%) create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/export-surface.ps1 create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/exports/README.md create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generate-help.ps1 create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generate-portal-ux.ps1 create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/Module.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/DataBoxManagementClient.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.dictionary.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.dictionary.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.dictionary.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.dictionary.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.dictionary.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.dictionary.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.dictionary.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.dictionary.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.dictionary.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.PowerShell.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.TypeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.json.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJobCredentials_List.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_Get.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_GetViaIdentity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_List.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_List1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxOperation_List.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_List.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_ListExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_ListViaJsonFilePath.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_ListViaJsonString.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_Book.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaIdentity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaIdentityExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaJsonFilePath.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaJsonString.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_Mark.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaIdentity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaIdentityExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaJsonFilePath.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaJsonString.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_Mitigate.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaIdentity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaIdentityExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaJsonFilePath.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaJsonString.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_Region.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_Region1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionExpanded1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentity1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonString.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonString1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/NewAzDataBoxJob_CreateExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/NewAzDataBoxJob_CreateViaJsonFilePath.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/NewAzDataBoxJob_CreateViaJsonString.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/RemoveAzDataBoxJob_Delete.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/RemoveAzDataBoxJob_DeleteViaIdentity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_Cancel.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaIdentity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaIdentityExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaJsonFilePath.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaJsonString.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_Validate.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaIdentity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaIdentityExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaJsonFilePath.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaJsonString.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_Validate.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_Validate1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateExpanded1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentity.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentity1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentityExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentityExpanded1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonFilePath.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonFilePath1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonString.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonString1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateViaIdentityExpanded.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateViaJsonFilePath.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateViaJsonString.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/AsyncCommandRuntime.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/AsyncJob.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/AsyncOperationResponse.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Attributes/ExternalDocsAttribute.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/CollectionExtensions.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/MarkdownRenderer.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsFormatTypes.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsHelpTypes.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsProxyOutputs.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsProxyTypes.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/PsAttributes.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/PsExtensions.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/PsHelpers.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/StringExtensions.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/XmlExtensions.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/CmdInfoHandler.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Context.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/ConversionException.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/IJsonConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/BinaryConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/BooleanConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DateTimeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DecimalConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DoubleConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/EnumConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/GuidConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/HashSet'1Converter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/Int16Converter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/Int32Converter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/Int64Converter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/JsonArrayConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/JsonObjectConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/SingleConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/StringConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/TimeSpanConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UInt16Converter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UInt32Converter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UInt64Converter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UriConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/JsonConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/JsonConverterAttribute.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/JsonConverterFactory.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/StringLikeConverter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/IJsonSerializable.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonArray.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonBoolean.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonNode.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonNumber.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonObject.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonString.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/XNodeArray.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Debugging.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/DictionaryExtensions.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventData.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventDataExtensions.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventListener.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Events.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventsExtensions.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Extensions.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/Extensions/TypeExtensions.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/Seperator.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/TypeDetails.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/XHelper.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/HttpPipeline.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/HttpPipelineMocking.ps1 create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/IAssociativeArray.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/IHeaderSerializable.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/ISendAsync.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/InfoAttribute.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/InputHandler.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Iso/IsoDate.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/JsonType.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/MessageAttribute.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/MessageAttributeHelper.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Method.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Models/JsonMember.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Models/JsonModel.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Models/JsonModelCache.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/JsonArray.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XImmutableArray.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XList.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XNodeArray.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XSet.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonBoolean.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonDate.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonNode.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonNumber.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonObject.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonString.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/XBinary.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/XNull.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/Exceptions/ParseException.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/JsonParser.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/JsonToken.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/JsonTokenizer.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/Location.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/Readers/SourceReader.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/TokenReader.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/PipelineMocking.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Properties/Resources.Designer.cs rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/generated/runtime/Properties/Resources.resx (100%) create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Response.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Serialization/JsonSerializer.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Serialization/PropertyTransformation.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Serialization/SerializationOptions.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/SerializationMode.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/TypeConverterExtensions.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/UndeclaredResponseException.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Writers/JsonWriter.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/delegates.cs create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/how-to.md create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/internal/Az.DataBox.internal.psm1 create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/internal/README.md rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/license.txt (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/pack-module.ps1 (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/resources/README.md (100%) create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/run-module.ps1 create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/target/test-module.ps1 rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/test/README.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/test/loadEnv.ps1 (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/tools/Resources/.gitattributes (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/tools/Resources/README.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/tools/Resources/custom/New-AzDeployment.ps1 (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/tools/Resources/docs/README.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/tools/Resources/examples/README.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/tools/Resources/how-to.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/tools/Resources/license.txt (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/tools/Resources/resources/CmdletSurface-latest-2019-04-30.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/tools/Resources/resources/ModelSurface.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/tools/Resources/resources/README.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/tools/Resources/test/README.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/utils/Get-SubscriptionIdTestSafe.ps1 (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => DataBox.Management.brown}/target/utils/Unprotect-SecureString.ps1 (100%) create mode 100644 tests-upgrade/tests-emitter/DataBox.Management.brown/tspconfig.yaml rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/Agent.tsp (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/Endpoint.tsp (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/JobDefinition.tsp (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/JobRun.tsp (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/Project.tsp (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/StorageMover.tsp (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/back-compatible.tsp (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/client.tsp (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Agents_CreateOrUpdate_MaximumSet.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Agents_CreateOrUpdate_MinimumSet.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Agents_CreateOrUpdate_UploadLimitSchedule_Overnight.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Agents_Delete.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Agents_Get_MaximumSet.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Agents_Get_MinimumSet.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Agents_List_MaximumSet.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Agents_List_MinimumSet.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Agents_Update.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_CreateOrUpdate_AzureStorageBlobContainer.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_CreateOrUpdate_AzureStorageSmbFileShare.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_CreateOrUpdate_NfsMount.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_CreateOrUpdate_SmbMount.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_Delete.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_Get_AzureStorageBlobContainer.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_Get_AzureStorageSmbFileShare.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_Get_NfsMount.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_Get_SmbMount.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_List.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_Update_AzureStorageBlobContainer.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_Update_AzureStorageSmbFileShare.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_Update_NfsMount.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Endpoints_Update_SmbMount.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/JobDefinitions_CreateOrUpdate.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/JobDefinitions_Delete.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/JobDefinitions_Get.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/JobDefinitions_List.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/JobDefinitions_StartJob.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/JobDefinitions_StopJob.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/JobDefinitions_Update.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/JobRuns_Get.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/JobRuns_List.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Operations_List.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Projects_CreateOrUpdate.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Projects_Delete.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Projects_Get.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Projects_List.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/Projects_Update.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/StorageMovers_CreateOrUpdate.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/StorageMovers_Delete.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/StorageMovers_Get.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/StorageMovers_List.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/StorageMovers_ListBySubscription.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2024-07-01/StorageMovers_Update.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Agents_CreateOrUpdate_MaximumSet.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Agents_CreateOrUpdate_MinimumSet.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Agents_CreateOrUpdate_UploadLimitSchedule_Overnight.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Agents_Delete.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Agents_Get_MaximumSet.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Agents_Get_MinimumSet.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Agents_List_MaximumSet.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Agents_List_MinimumSet.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Agents_Update.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureMultiCloudConnector.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageBlobContainer.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageNfsFileShare.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageSmbFileShare.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_CreateOrUpdate_NfsMount.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_CreateOrUpdate_SmbMount.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Delete.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Get_AzureMultiCloudConnector.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Get_AzureStorageBlobContainer.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Get_AzureStorageNfsFileShare.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Get_AzureStorageSmbFileShare.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Get_NfsMount.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Get_SmbMount.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_List.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Update_AzureMultiCloudConnector.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Update_AzureStorageBlobContainer.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Update_AzureStorageNfsFileShare.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Update_AzureStorageSmbFileShare.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Update_NfsMount.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Endpoints_Update_SmbMount.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/JobDefinitions_CreateOrUpdate.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/JobDefinitions_CreateOrUpdate_CloudToCloud.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/JobDefinitions_Delete.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/JobDefinitions_Get.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/JobDefinitions_List.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/JobDefinitions_StartJob.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/JobDefinitions_StopJob.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/JobDefinitions_Update.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/JobRuns_Get.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/JobRuns_List.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Operations_List.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Projects_CreateOrUpdate.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Projects_Delete.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Projects_Get.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Projects_List.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/Projects_Update.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/StorageMovers_CreateOrUpdate.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/StorageMovers_Delete.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/StorageMovers_Get.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/StorageMovers_List.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/StorageMovers_ListBySubscription.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/examples/2025-07-01/StorageMovers_Update.json (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/main.tsp (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/models.tsp (100%) create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/.gitattributes rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/Az.StorageMover.csproj (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/Az.StorageMover.nuspec (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/Az.StorageMover.psm1 (100%) create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/MSSharedLibKey.snk rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/Properties/AssemblyInfo.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/README.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/build-module.ps1 (100%) create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/check-dependencies.ps1 rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/create-model-cmdlets.ps1 (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/custom/Az.StorageMover.custom.psm1 (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/custom/README.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/docs/README.md (100%) create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/examples/README.md rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/export-surface.ps1 (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/exports/README.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generate-help.ps1 (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generate-portal-ux.ps1 (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/Module.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Agent.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Agent.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Agent.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Agent.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentList.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentList.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentList.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentList.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentPropertiesErrorDetails.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentPropertiesErrorDetails.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentPropertiesErrorDetails.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentPropertiesErrorDetails.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentUpdateParameters.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentUpdateParameters.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentUpdateParameters.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentUpdateParameters.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentUpdateProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentUpdateProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentUpdateProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AgentUpdateProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Any.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Any.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Any.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Any.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureKeyVaultSmbCredentials.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureKeyVaultSmbCredentials.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureKeyVaultSmbCredentials.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureKeyVaultSmbCredentials.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureMultiCloudConnectorEndpointProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureMultiCloudConnectorEndpointProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureMultiCloudConnectorEndpointProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureMultiCloudConnectorEndpointProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureMultiCloudConnectorEndpointUpdateProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureMultiCloudConnectorEndpointUpdateProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureMultiCloudConnectorEndpointUpdateProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureMultiCloudConnectorEndpointUpdateProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageBlobContainerEndpointProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageBlobContainerEndpointProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageBlobContainerEndpointProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageBlobContainerEndpointProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageBlobContainerEndpointUpdateProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageBlobContainerEndpointUpdateProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageBlobContainerEndpointUpdateProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageBlobContainerEndpointUpdateProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageNfsFileShareEndpointProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageNfsFileShareEndpointProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageNfsFileShareEndpointProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageNfsFileShareEndpointProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageNfsFileShareEndpointUpdateProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageNfsFileShareEndpointUpdateProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageNfsFileShareEndpointUpdateProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageNfsFileShareEndpointUpdateProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageSmbFileShareEndpointProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageSmbFileShareEndpointProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageSmbFileShareEndpointProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageSmbFileShareEndpointProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageSmbFileShareEndpointUpdateProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageSmbFileShareEndpointUpdateProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageSmbFileShareEndpointUpdateProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/AzureStorageSmbFileShareEndpointUpdateProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Credentials.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Credentials.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Credentials.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Credentials.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Endpoint.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Endpoint.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Endpoint.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Endpoint.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointBaseProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointBaseProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointBaseProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointBaseProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointBaseUpdateParameters.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointBaseUpdateParameters.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointBaseUpdateParameters.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointBaseUpdateParameters.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointBaseUpdateProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointBaseUpdateProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointBaseUpdateProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointBaseUpdateProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointList.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointList.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointList.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/EndpointList.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ErrorAdditionalInfo.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ErrorAdditionalInfo.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ErrorDetail.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ErrorDetail.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ErrorDetail.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ErrorDetail.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ErrorResponse.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ErrorResponse.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ErrorResponse.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ErrorResponse.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinition.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinition.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinition.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinition.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionList.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionList.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionList.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionList.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionPropertiesSourceTargetMap.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionPropertiesSourceTargetMap.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionPropertiesSourceTargetMap.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionPropertiesSourceTargetMap.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionUpdateParameters.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionUpdateParameters.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionUpdateParameters.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionUpdateParameters.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionUpdateProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionUpdateProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionUpdateProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobDefinitionUpdateProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRun.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRun.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRun.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRun.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunError.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunError.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunError.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunError.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunList.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunList.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunList.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunList.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunResourceId.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunResourceId.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunResourceId.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/JobRunResourceId.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ManagedServiceIdentity.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ManagedServiceIdentity.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ManagedServiceIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ManagedServiceIdentity.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ManagedServiceIdentityUserAssignedIdentities.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ManagedServiceIdentityUserAssignedIdentities.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ManagedServiceIdentityUserAssignedIdentities.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ManagedServiceIdentityUserAssignedIdentities.dictionary.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ManagedServiceIdentityUserAssignedIdentities.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/NfsMountEndpointProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/NfsMountEndpointProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/NfsMountEndpointProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/NfsMountEndpointProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/NfsMountEndpointUpdateProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/NfsMountEndpointUpdateProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/NfsMountEndpointUpdateProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/NfsMountEndpointUpdateProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Operation.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Operation.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Operation.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Operation.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/OperationDisplay.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/OperationDisplay.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/OperationDisplay.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/OperationDisplay.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/OperationListResult.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/OperationListResult.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/OperationListResult.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/OperationListResult.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Project.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Project.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Project.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Project.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectList.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectList.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectList.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectList.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectUpdateParameters.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectUpdateParameters.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectUpdateParameters.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectUpdateParameters.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectUpdateProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectUpdateProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectUpdateProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProjectUpdateProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProxyResource.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProxyResource.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProxyResource.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/ProxyResource.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Recurrence.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Recurrence.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Recurrence.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Recurrence.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Resource.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Resource.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Resource.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Resource.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SmbMountEndpointProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SmbMountEndpointProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SmbMountEndpointProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SmbMountEndpointProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SmbMountEndpointUpdateProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SmbMountEndpointUpdateProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SmbMountEndpointUpdateProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SmbMountEndpointUpdateProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SourceEndpoint.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SourceEndpoint.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SourceEndpoint.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SourceEndpoint.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SourceEndpointProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SourceEndpointProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SourceEndpointProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SourceEndpointProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SourceTargetMap.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SourceTargetMap.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SourceTargetMap.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SourceTargetMap.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMover.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMover.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMover.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverIdentity.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverIdentity.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverIdentity.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverList.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverList.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverList.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverList.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateParameters.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateParameters.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateParameters.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateParameters.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateParametersTags.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateParametersTags.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateParametersTags.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateParametersTags.dictionary.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateParametersTags.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/StorageMoverUpdateProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SystemData.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SystemData.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SystemData.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/SystemData.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TargetEndpoint.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TargetEndpoint.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TargetEndpoint.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TargetEndpoint.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TargetEndpointProperties.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TargetEndpointProperties.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TargetEndpointProperties.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TargetEndpointProperties.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Time.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Time.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Time.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/Time.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TrackedResource.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TrackedResource.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TrackedResource.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TrackedResource.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TrackedResourceTags.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TrackedResourceTags.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TrackedResourceTags.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TrackedResourceTags.dictionary.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/TrackedResourceTags.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/UploadLimitSchedule.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/UploadLimitSchedule.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/UploadLimitSchedule.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/UploadLimitSchedule.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/UploadLimitWeeklyRecurrence.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/UploadLimitWeeklyRecurrence.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/UploadLimitWeeklyRecurrence.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/UploadLimitWeeklyRecurrence.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/UserAssignedIdentity.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/UserAssignedIdentity.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/UserAssignedIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/UserAssignedIdentity.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/WeeklyRecurrence.PowerShell.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/WeeklyRecurrence.TypeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/WeeklyRecurrence.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/Models/WeeklyRecurrence.json.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/api/StorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverAgent_Get.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverAgent_GetViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverAgent_GetViaIdentityStorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverAgent_List.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverEndpoint_Get.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverEndpoint_GetViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverEndpoint_GetViaIdentityStorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverEndpoint_List.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverJobDefinition_Get.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverJobDefinition_GetViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverJobDefinition_GetViaIdentityProject.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverJobDefinition_GetViaIdentityStorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverJobDefinition_List.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverJobRun_Get.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverJobRun_GetViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverJobRun_GetViaIdentityJobDefinition.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverJobRun_GetViaIdentityProject.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverJobRun_GetViaIdentityStorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverJobRun_List.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverOperation_List.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverProject_Get.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverProject_GetViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverProject_GetViaIdentityStorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMoverProject_List.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMover_Get.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMover_GetViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMover_List.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/GetAzStorageMover_List1.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMoverAgent_CreateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMoverAgent_CreateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMoverAgent_CreateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMoverEndpoint_CreateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMoverEndpoint_CreateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMoverEndpoint_CreateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMoverJobDefinition_CreateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMoverJobDefinition_CreateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMoverJobDefinition_CreateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMoverProject_CreateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMoverProject_CreateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMoverProject_CreateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMover_CreateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMover_CreateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/NewAzStorageMover_CreateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverAgent_Delete.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverAgent_DeleteViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverAgent_DeleteViaIdentityStorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverEndpoint_Delete.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverEndpoint_DeleteViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverEndpoint_DeleteViaIdentityStorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverJobDefinition_Delete.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverJobDefinition_DeleteViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverJobDefinition_DeleteViaIdentityProject.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverJobDefinition_DeleteViaIdentityStorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverProject_Delete.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverProject_DeleteViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMoverProject_DeleteViaIdentityStorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMover_Delete.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/RemoveAzStorageMover_DeleteViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMoverAgent_UpdateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMoverAgent_UpdateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMoverAgent_UpdateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMoverEndpoint_UpdateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMoverEndpoint_UpdateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMoverEndpoint_UpdateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMoverJobDefinition_UpdateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMoverJobDefinition_UpdateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMoverJobDefinition_UpdateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMoverProject_UpdateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMoverProject_UpdateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMoverProject_UpdateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMover_UpdateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMover_UpdateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/SetAzStorageMover_UpdateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/StartAzStorageMoverJobDefinitionJob_Start.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/StartAzStorageMoverJobDefinitionJob_StartViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/StartAzStorageMoverJobDefinitionJob_StartViaIdentityProject.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/StartAzStorageMoverJobDefinitionJob_StartViaIdentityStorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/StopAzStorageMoverJobDefinitionJob_Stop.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/StopAzStorageMoverJobDefinitionJob_StopViaIdentity.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/StopAzStorageMoverJobDefinitionJob_StopViaIdentityProject.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/StopAzStorageMoverJobDefinitionJob_StopViaIdentityStorageMover.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverAgent_UpdateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverAgent_UpdateViaIdentityExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverAgent_UpdateViaIdentityStorageMoverExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverAgent_UpdateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverAgent_UpdateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverEndpoint_UpdateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverEndpoint_UpdateViaIdentityExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverEndpoint_UpdateViaIdentityStorageMoverExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverJobDefinition_UpdateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverJobDefinition_UpdateViaIdentityExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverJobDefinition_UpdateViaIdentityProjectExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverJobDefinition_UpdateViaIdentityStorageMoverExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverJobDefinition_UpdateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverJobDefinition_UpdateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverProject_UpdateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverProject_UpdateViaIdentityExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverProject_UpdateViaIdentityStorageMoverExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverProject_UpdateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMoverProject_UpdateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMover_UpdateExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMover_UpdateViaIdentityExpanded.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMover_UpdateViaJsonFilePath.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/cmdlets/UpdateAzStorageMover_UpdateViaJsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/AsyncCommandRuntime.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/AsyncJob.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/AsyncOperationResponse.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Attributes/ExternalDocsAttribute.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/CollectionExtensions.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/MarkdownRenderer.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Models/PsFormatTypes.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Models/PsHelpTypes.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Models/PsProxyOutputs.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/Models/PsProxyTypes.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/PsAttributes.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/PsExtensions.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/PsHelpers.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/StringExtensions.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/BuildTime/XmlExtensions.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/CmdInfoHandler.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Context.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/ConversionException.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/IJsonConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/BinaryConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/BooleanConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/DateTimeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/DecimalConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/DoubleConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/EnumConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/GuidConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/HashSet'1Converter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/Int16Converter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/Int32Converter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/Int64Converter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/JsonArrayConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/JsonObjectConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/SingleConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/StringConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/TimeSpanConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/UInt16Converter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/UInt32Converter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/UInt64Converter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/Instances/UriConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/JsonConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/JsonConverterAttribute.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/JsonConverterFactory.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Conversions/StringLikeConverter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Customizations/IJsonSerializable.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Customizations/JsonArray.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Customizations/JsonBoolean.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Customizations/JsonNode.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Customizations/JsonNumber.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Customizations/JsonObject.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Customizations/JsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Customizations/XNodeArray.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Debugging.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/DictionaryExtensions.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/EventData.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/EventDataExtensions.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/EventListener.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Events.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/EventsExtensions.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Extensions.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Helpers/Extensions/TypeExtensions.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Helpers/Seperator.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Helpers/TypeDetails.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Helpers/XHelper.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/HttpPipeline.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/HttpPipelineMocking.ps1 (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/IAssociativeArray.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/IHeaderSerializable.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/ISendAsync.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/InfoAttribute.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/InputHandler.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Iso/IsoDate.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/JsonType.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/MessageAttribute.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/MessageAttributeHelper.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Method.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Models/JsonMember.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Models/JsonModel.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Models/JsonModelCache.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/Collections/JsonArray.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/Collections/XImmutableArray.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/Collections/XList.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/Collections/XNodeArray.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/Collections/XSet.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/JsonBoolean.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/JsonDate.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/JsonNode.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/JsonNumber.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/JsonObject.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/JsonString.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/XBinary.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Nodes/XNull.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Parser/Exceptions/ParseException.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Parser/JsonParser.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Parser/JsonToken.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Parser/JsonTokenizer.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Parser/Location.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Parser/Readers/SourceReader.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Parser/TokenReader.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/PipelineMocking.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Properties/Resources.Designer.cs (100%) create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/Properties/Resources.resx rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Response.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Serialization/JsonSerializer.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Serialization/PropertyTransformation.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Serialization/SerializationOptions.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/SerializationMode.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/TypeConverterExtensions.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/UndeclaredResponseException.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/Writers/JsonWriter.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/generated/runtime/delegates.cs (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/how-to.md (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/internal/Az.StorageMover.internal.psm1 (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/internal/README.md (100%) create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/license.txt create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/pack-module.ps1 create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/resources/README.md rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/run-module.ps1 (100%) rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/target/test-module.ps1 (100%) create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/test/README.md create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/test/loadEnv.ps1 create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/.gitattributes create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/README.md create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/custom/New-AzDeployment.ps1 create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/docs/README.md create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/examples/README.md create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/how-to.md create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/license.txt create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/resources/CmdletSurface-latest-2019-04-30.md create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/resources/ModelSurface.md create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/resources/README.md create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/test/README.md create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/utils/Get-SubscriptionIdTestSafe.ps1 create mode 100644 tests-upgrade/tests-emitter/StorageMover.Management.brown/target/utils/Unprotect-SecureString.ps1 rename tests-upgrade/tests-emitter/{StorageMover.Management => StorageMover.Management.brown}/tspconfig.yaml (100%) delete mode 100644 tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/.gitignore diff --git a/packages/typespec-powershell/src/utils/modelUtils.ts b/packages/typespec-powershell/src/utils/modelUtils.ts index 44047b91cf2..ff941889985 100644 --- a/packages/typespec-powershell/src/utils/modelUtils.ts +++ b/packages/typespec-powershell/src/utils/modelUtils.ts @@ -989,7 +989,7 @@ function getSchemaForModel( } else { // If discriminator value is union variant, it will be constant type // Otherwise, it will be sealed choice type - modelSchema.discriminatorValue = propSchema.type === 'constant' ? (propSchema).value.value : (propSchema).choices[0].value.toString(); + modelSchema.discriminatorValue = propSchema.type === 'constant' ? (propSchema).value.value : (propSchema.value ? propSchema.value : (propSchema).choices[0].value.toString()); } if (discriminator && propName === discriminator.propertyName) { property.isDiscriminator = true; diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/JobResource.tsp b/tests-upgrade/tests-emitter/DataBox.Management.brown/JobResource.tsp new file mode 100644 index 00000000000..9103f2d51d1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/JobResource.tsp @@ -0,0 +1,200 @@ +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; + +using TypeSpec.Rest; +using Azure.ResourceManager; +using TypeSpec.Http; +using TypeSpec.OpenAPI; + +namespace Microsoft.DataBox; +/** + * Job Resource. + */ +model JobResource + is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = JobResource, + KeyName = "jobName", + SegmentName = "jobs", + NamePattern = "^[-\\w\\.]+$" + >; + + /** + * The sku type. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + sku: Sku; + + /** + * Msi identity of the resource + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + identity?: ResourceIdentity; +} + +@armResourceOperations +interface JobResources { + /** + * Gets information about the specified job. + */ + get is ArmResourceRead< + JobResource, + Parameters = { + /** + * $expand is supported on details parameter for job, which provides details on the job stages. + */ + @query("$expand") + $expand?: string; + }, + Error = ApiError + >; + + /** + * Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + create is ArmResourceCreateOrReplaceAsync< + JobResource, + Response = ArmResourceUpdatedResponse | ArmAcceptedLroResponse & + Azure.Core.Foundations.RetryAfterHeader>, + Error = ApiError + >; + + /** + * Updates the properties of an existing job. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-patch" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @patch(#{ implicitOptionality: false }) + update is ArmCustomPatchAsync< + JobResource, + PatchModel = JobResourceUpdateParameter, + Parameters = { + /** + * Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @header("If-Match") + `If-Match`?: string; + }, + Error = ApiError + >; + + /** + * Deletes a job. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + delete is ArmResourceDeleteWithoutOkAsync< + JobResource, + Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse, + Error = ApiError + >; + + /** + * Lists all the jobs available under the given resource group. + */ + listByResourceGroup is ArmResourceListByParent< + JobResource, + Parameters = { + /** + * $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + */ + @query("$skipToken") + $skipToken?: string; + }, + Response = ArmResponse, + Error = ApiError + >; + + /** + * Lists all the jobs available under the subscription. + */ + list is ArmListBySubscription< + JobResource, + Parameters = { + /** + * $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + */ + @query("$skipToken") + $skipToken?: string; + }, + Response = ArmResponse, + Error = ApiError + >; + + /** + * Book shipment pick up. + */ + bookShipmentPickUp is ArmResourceActionSync< + JobResource, + ShipmentPickUpRequest, + ArmResponse, + Error = ApiError + >; + + /** + * CancelJob. + */ + cancel is ArmResourceActionSync< + JobResource, + CancellationReason, + NoContentResponse, + Error = ApiError + >; + + /** + * This method gets the unencrypted secrets related to the job. + */ + @list + listCredentials is ArmResourceActionSync< + JobResource, + void, + ArmResponse, + Error = ApiError + >; + + /** + * Request to mark devices for a given job as shipped + */ + markDevicesShipped is ArmResourceActionSync< + JobResource, + MarkDevicesShippedRequest, + NoContentResponse, + Error = ApiError + >; +} + +/** + * Request to mitigate for a given job + */ +@action("mitigate") +@tag("JobResources") +op mitigate is ArmResourceActionSync< + JobResource, + MitigateJobRequest, + NoContentResponse, + Error = ApiError +>; + +@@maxLength(JobResource.name, 24); +@@minLength(JobResource.name, 3); +@@doc(JobResource.name, + "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only" +); +@@doc(JobResource.properties, "Properties of a job."); +@@doc(JobResources.create::parameters.resource, + "Job details from request body." +); +@@doc(JobResources.update::parameters.properties, + "Job update parameters from request body." +); +@@doc(JobResources.bookShipmentPickUp::parameters.body, + "Details of shipment pick up request." +); +@@doc(JobResources.cancel::parameters.body, "Reason for cancellation."); +@@doc(JobResources.markDevicesShipped::parameters.body, + "Mark Devices Shipped Request" +); +@@doc(mitigate::parameters.body, "Mitigation Request"); diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/back-compatible.tsp b/tests-upgrade/tests-emitter/DataBox.Management.brown/back-compatible.tsp new file mode 100644 index 00000000000..ff7964e859c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/back-compatible.tsp @@ -0,0 +1,99 @@ +import "@azure-tools/typespec-client-generator-core"; + +using Azure.ClientGenerator.Core; +using Microsoft.DataBox; + +#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@Azure.ClientGenerator.Core.Legacy.flattenProperty(AddressValidationOutput.properties, + "!csharp" +); + +#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@Azure.ClientGenerator.Core.Legacy.flattenProperty(ValidationResponse.properties +); + +#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@Azure.ClientGenerator.Core.Legacy.flattenProperty(JobResourceUpdateParameter.properties +); + +#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@Azure.ClientGenerator.Core.Legacy.flattenProperty(SkuInformation.properties); + +@@clientLocation(JobResources.get, "Jobs", "!csharp"); + +@@clientLocation(JobResources.create, "Jobs", "!csharp"); + +@@clientName(JobResources.create::parameters.resource, "jobResource"); + +@@clientLocation(JobResources.update, "Jobs", "!csharp"); + +@@clientName(JobResources.update::parameters.properties, + "jobResourceUpdateParameter" +); + +@@clientLocation(JobResources.delete, "Jobs", "!csharp"); + +@@clientLocation(JobResources.listByResourceGroup, "Jobs", "!csharp"); + +@@clientLocation(JobResources.list, "Jobs", "!csharp"); + +@@clientLocation(JobResources.bookShipmentPickUp, "Jobs", "!csharp"); + +@@clientName(JobResources.bookShipmentPickUp::parameters.body, + "shipmentPickUpRequest" +); + +@@clientLocation(JobResources.cancel, "Jobs", "!csharp"); + +@@clientName(JobResources.cancel::parameters.body, "cancellationReason"); + +@@clientLocation(JobResources.listCredentials, "Jobs", "!csharp"); + +@@clientLocation(JobResources.markDevicesShipped, "Jobs", "!csharp"); + +@@clientName(JobResources.markDevicesShipped::parameters.body, + "markDevicesShippedRequest" +); + +@@clientName(mitigate::parameters.body, "mitigateJobRequest"); + +#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@Azure.ClientGenerator.Core.Legacy.flattenProperty(JobResource.properties); + +@@clientLocation(ServiceOperationGroup.regionConfiguration, + "Service", + "!csharp" +); + +@@clientLocation(ServiceOperationGroup.validateAddress, "Service", "!csharp"); + +@@clientLocation(ServiceOperationGroup.validateInputs, "Service", "!csharp"); + +@@clientLocation(ServiceOperationGroup.listAvailableSkusByResourceGroup, + "Service", + "!csharp" +); + +@@clientLocation(ServiceOperationGroup.regionConfigurationByResourceGroup, + "Service", + "!csharp" +); + +@@clientLocation(ServiceOperationGroup.validateInputsByResourceGroup, + "Service", + "!csharp" +); + +@@clientName(ServiceOperationGroup.regionConfiguration::parameters.body, + "regionConfigurationRequest" +); +@@clientName(ServiceOperationGroup.validateAddress::parameters.body, + "validateAddress" +); +@@clientName(ServiceOperationGroup.validateInputs::parameters.body, + "validationRequest" +); + +@@clientLocation(mitigate, "Management", "go"); +#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@Azure.ClientGenerator.Core.Legacy.flattenProperty(Operation.properties); diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/client.tsp b/tests-upgrade/tests-emitter/DataBox.Management.brown/client.tsp new file mode 100644 index 00000000000..6b5b8f631a8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/client.tsp @@ -0,0 +1,312 @@ +import "@azure-tools/typespec-client-generator-core"; +import "./main.tsp"; + +using Azure.ClientGenerator.Core; +using Azure.Core; +using Microsoft.DataBox; + +@@scope(Operations.list, "!csharp"); + +@@clientName(JobDetails, "CommonJobDetails", "go"); +@@clientName(JobSecrets, "CommonJobSecrets", "go"); +@@clientName(ScheduleAvailabilityRequest, + "CommonScheduleAvailabilityRequest", + "go" +); +@@clientName(Microsoft.DataBox, "DataBoxManagementClient", "javascript"); +@@clientName(Microsoft.DataBox, "DataBoxManagementClient", "python"); + +@@clientName(JobResource, "DataBoxJob", "csharp"); +@@clientName(JobResourceUpdateParameter, "DataBoxJobPatch", "csharp"); +@@clientName(JobResourceList, "DataBoxJobListResult", "csharp"); +@@clientName(CreateJobValidations, "CreateJobValidationContent", "csharp"); +@@clientName(CreateOrderLimitForSubscriptionValidationRequest, + "CreateOrderLimitForSubscriptionValidationContent", + "csharp" +); +@@clientName(CreateOrderLimitForSubscriptionValidationResponseProperties, + "CreateOrderLimitForSubscriptionValidationResult", + "csharp" +); +@@clientName(DataTransferDetailsValidationResponseProperties, + "DataTransferDetailsValidationResult", + "csharp" +); +@@clientName(PreferencesValidationResponseProperties, + "PreferencesValidationResult", + "csharp" +); +@@clientName(SkuAvailabilityValidationResponseProperties, + "SkuAvailabilityValidationResult", + "csharp" +); +@@clientName(SubscriptionIsAllowedToCreateJobValidationResponseProperties, + "SubscriptionIsAllowedToCreateJobValidationResult", + "csharp" +); +@@clientName(AddressValidationProperties, "AddressValidationResult", "csharp"); +@@clientName(ValidationInputResponse, "DataBoxValidationInputResult", "csharp"); +@@clientName(DataBoxCustomerDiskJobDetails.deliverToDcPackageDetails, + "DeliverToDataCenterPackageDetails", + "csharp" +); +@@clientName(DataBoxCustomerDiskJobDetails.exportDiskDetailsCollection, + "ExportDiskDetails", + "csharp" +); +@@clientName(DataBoxCustomerDiskJobDetails.importDiskDetailsCollection, + "ImportDiskDetails", + "csharp" +); +@@clientName(DataBoxDiskJobSecrets.passKey, "Passkey", "csharp"); +@@clientName(DataBoxScheduleAvailabilityRequest, + "DataBoxScheduleAvailabilityContent", + "csharp" +); +@@clientName(DiskScheduleAvailabilityRequest, + "DiskScheduleAvailabilityContent", + "csharp" +); +@@clientName(HeavyScheduleAvailabilityRequest, + "HeavyScheduleAvailabilityContent", + "csharp" +); +@@clientName(ScheduleAvailabilityRequest, + "ScheduleAvailabilityContent", + "csharp" +); +@@clientName(SkuInformation.enabled, "IsEnabled", "csharp"); +@@clientName(DatacenterAddressInstructionResponse, + "DataCenterAddressInstructionResult", + "csharp" +); +@@clientName(DatacenterAddressLocationResponse, + "DataCenterAddressLocationResult", + "csharp" +); +@@clientName(DatacenterAddressResponse, "DataCenterAddressResult", "csharp"); +@@clientName(DatacenterAddressRequest, "DataCenterAddressContent", "csharp"); +@@clientName(DataTransferDetailsValidationRequest, + "DataTransferDetailsValidationContent", + "csharp" +); +@@clientName(PreferencesValidationRequest, + "PreferencesValidationContent", + "csharp" +); +@@clientName(SkuAvailabilityValidationRequest, + "SkuAvailabilityValidationContent", + "csharp" +); +@@clientName(SubscriptionIsAllowedToCreateJobValidationRequest, + "SubscriptionIsAllowedToCreateJobValidationContent", + "csharp" +); +@@clientName(ValidateAddress, "DataBoxValidateAddressContent", "csharp"); +@@clientName(DcAccessSecurityCode, "DataCenterAccessSecurityCode", "csharp"); +@@clientName(DcAccessSecurityCode.forwardDCAccessCode, + "ForwardDataCenterAccessCode", + "csharp" +); +@@clientName(DcAccessSecurityCode.reverseDCAccessCode, + "ReverseDataCenterAccessCode", + "csharp" +); +@@clientName(KekType, "DataBoxKeyEncryptionKeyType", "csharp"); +@@clientName(IdentityProperties, "DataBoxManagedIdentity", "csharp"); +@@clientName(KeyEncryptionKey.identityProperties, "ManagedIdentity", "csharp"); +@@clientName(IdentityProperties.type, "IdentityType", "csharp"); +@@clientName(UserAssignedProperties, "DataBoxUserAssignedIdentity", "csharp"); +@@clientName(JobDetails, "DataBoxBasicJobDetails", "csharp"); +@@clientName(JobDetails.datacenterAddress, "DataCenterAddress", "csharp"); +@@clientName(JobDetails.expectedDataSizeInTeraBytes, + "ExpectedDataSizeInTerabytes", + "csharp" +); +@@clientName(JobStages, "DataBoxJobStage", "csharp"); +@@clientName(Preferences, "DataBoxOrderPreferences", "csharp"); +@@clientName(RegionConfigurationRequest, + "RegionConfigurationContent", + "csharp" +); +@@clientName(RegionConfigurationResponse, + "RegionConfigurationResult", + "csharp" +); +@@clientName(ShipmentPickUpResponse, "DataBoxShipmentPickUpResult", "csharp"); +@@clientName(ShipmentPickUpResponse.readyByTime, "ReadyBy", "csharp"); +@@clientName(ValidationInputRequest, "DataBoxValidationInputContent", "csharp"); +@@clientName(ValidationRequest, "DataBoxValidationContent", "csharp"); +@@clientName(ValidationResponse, "DataBoxValidationResult", "csharp"); +@@clientName(AddressType, "DataBoxShippingAddressType", "csharp"); +@@clientName(AvailableSkuRequest, "AvailableSkusContent", "csharp"); +@@clientName(CancellationReason, "DataBoxJobCancellationReason", "csharp"); +@@clientName(ClassDiscriminator, "DataBoxOrderType", "csharp"); +@@clientName(TransferType, "DataBoxJobTransferType", "csharp"); +@@clientName(JobSecrets.dcAccessSecurityCode, + "DataCenterAccessSecurityCode", + "csharp" +); +@@clientName(MarkDevicesShippedRequest.deliverToDcPackageDetails, + "DeliverToDataCenterPackageDetails", + "csharp" +); +@@clientName(LastMitigationActionOnJob.actionDateTimeInUtc, + "ActionPerformedOn", + "csharp" +); +@@clientName(TransportAvailabilityRequest, + "TransportAvailabilityContent", + "csharp" +); +@@clientName(DeviceCapabilityRequest, "DeviceCapabilityContent", "csharp"); +@@clientName(JobProperties.allDevicesLost, "AreAllDevicesLost", "csharp"); +@@clientName(ModelName, "DeviceModelName", "csharp"); +@@clientName(DataboxJobSecrets, "DataBoxJobSecrets", "csharp"); + +@@clientName(CopyStatus, "DataBoxCopyStatus", "csharp"); +@@clientName(CopyProgress, "DataBoxCopyProgress", "csharp"); +@@clientName(KeyEncryptionKey, "DataBoxKeyEncryptionKey", "csharp"); +@@clientName(ShippingAddress, "DataBoxShippingAddress", "csharp"); +@@clientName(StageName, "DataBoxStageName", "csharp"); +@@clientName(AccessProtocol, "DataBoxAccessProtocol", "csharp"); +@@clientName(AccessProtocol.SMB, "Smb", "csharp"); +@@clientName(AccessProtocol.NFS, "Nfs", "csharp"); +@@clientName(AccountCredentialDetails, + "DataBoxAccountCredentialDetails", + "csharp" +); +@@clientName(ContactDetails, "DataBoxContactDetails", "csharp"); +@@clientName(DiskSecret, "DataBoxDiskSecret", "csharp"); +@@clientName(DoubleEncryption, "DataBoxDoubleEncryption", "csharp"); +@@clientName(EncryptionPreferences, "DataBoxEncryptionPreferences", "csharp"); +@@clientName(SkuCapacity, "DataBoxSkuCapacity", "csharp"); +@@clientName(SkuCost, "DataBoxSkuCost", "csharp"); +@@clientName(StageStatus, "DataBoxStageStatus", "csharp"); +@@clientName(StorageAccountDetails, "DataBoxStorageAccountDetails", "csharp"); +@@clientName(ValidationStatus, "DataBoxValidationStatus", "csharp"); +@@clientName(ValidationInputDiscriminator, + "DataBoxValidationInputDiscriminator", + "csharp" +); +@@clientName(StageName.AtAzureDC, "AtAzureDataCenter", "csharp"); +@@clientName(StageName.Failed_IssueDetectedAtAzureDC, + "FailedIssueDetectedAtAzureDataCenter", + "csharp" +); +@@clientName(StageName.ReadyToDispatchFromAzureDC, + "ReadyToDispatchFromAzureDataCenter", + "csharp" +); +@@clientName(StageName.ReadyToReceiveAtAzureDC, + "ReadyToReceiveAtAzureDataCenter", + "csharp" +); +@@clientName(StageName.ShippedToAzureDC, "ShippedToAzureDataCenter", "csharp"); +@@clientName(StageName.PreparingToShipFromAzureDC, + "PreparingToShipFromAzureDataCenter", + "csharp" +); +@@clientName(NotificationStageName.AtAzureDC, "AtAzureDataCenter", "csharp"); +@@clientName(DiskScheduleAvailabilityRequest.expectedDataSizeInTeraBytes, + "ExpectedDataSizeInTerabytes", + "csharp" +); +@@clientName(RegionConfigurationRequest.datacenterAddressRequest, + "DataCenterAddressRequest", + "csharp" +); +@@clientName(RegionConfigurationResponse.datacenterAddressResponse, + "DataCenterAddressResponse", + "csharp" +); +@@clientName(JobDetails.datacenterAddress, "DataCenterAddress", "csharp"); +@@clientName(ShareDestinationFormatType.HCS, "Hcs", "csharp"); +#suppress "@azure-tools/typespec-client-generator-core/duplicate-client-name-warning" "Confirmed overload operations" +@@clientName(ServiceOperationGroup.regionConfiguration, + "GetRegionConfiguration", + "csharp" +); +@@clientName(ServiceOperationGroup.validateAddress, + "ValidateAddress", + "csharp" +); +#suppress "@azure-tools/typespec-client-generator-core/duplicate-client-name-warning" "Confirmed overload operations" +@@clientName(ServiceOperationGroup.validateInputs, "ValidateInputs", "csharp"); +@@clientName(ServiceOperationGroup.listAvailableSkusByResourceGroup, + "GetAvailableSkus", + "csharp" +); +#suppress "@azure-tools/typespec-client-generator-core/duplicate-client-name-warning" "Confirmed overload operations" +@@clientName(ServiceOperationGroup.regionConfigurationByResourceGroup, + "GetRegionConfiguration", + "csharp" +); +@@clientName(mitigate, "Mitigate", "csharp"); +#suppress "@azure-tools/typespec-client-generator-core/duplicate-client-name-warning" "Confirmed overload operations" +@@clientName(ServiceOperationGroup.validateInputsByResourceGroup, + "ValidateInputs", + "csharp" +); +@@alternateType(KeyEncryptionKey.kekVaultResourceID, + armResourceIdentifier, + "csharp" +); +@@alternateType(UserAssignedProperties.resourceId, + armResourceIdentifier, + "csharp" +); +@@alternateType(CopyProgress.accountId, armResourceIdentifier, "csharp"); +@@alternateType(DataBoxDiskGranularCopyLogDetails.accountId, + armResourceIdentifier, + "csharp" +); +@@alternateType(StorageAccountDetails.storageAccountId, + armResourceIdentifier, + "csharp" +); +@@alternateType(GranularCopyProgress.accountId, + armResourceIdentifier, + "csharp" +); +@@alternateType(ManagedDiskDetails.resourceGroupId, + armResourceIdentifier, + "csharp" +); +@@alternateType(ManagedDiskDetails.stagingStorageAccountId, + armResourceIdentifier, + "csharp" +); +@@alternateType(AvailableSkuRequest.location, azureLocation, "csharp"); +@@alternateType(SkuAvailabilityValidationRequest.location, + azureLocation, + "csharp" +); +@@alternateType(ScheduleAvailabilityRequest.storageLocation, + azureLocation, + "csharp" +); +@@alternateType(DatacenterAddressRequest.storageLocation, + azureLocation, + "csharp" +); +@@alternateType(DatacenterAddressResponse.dataCenterAzureLocation, + azureLocation, + "csharp" +); +@@alternateType(DataLocationToServiceLocationMap.dataLocation, + azureLocation, + "csharp" +); +@@alternateType(DataLocationToServiceLocationMap.serviceLocation, + azureLocation, + "csharp" +); +@@alternateType(KeyEncryptionKey.kekUrl, url, "csharp"); +@@alternateType(PackageShippingDetails.trackingUrl, url, "csharp"); +@@alternateType(SkuCost.meterId, uuid, "csharp"); + +@@clientName(KeyEncryptionKey.kekVaultResourceID, "kekVaultResourceId", "java"); +@@clientName(ShareCredentialDetails.userName, "username", "java"); +@@alternateType(AdditionalErrorInfo.info, unknown, "java"); +@@alternateType(JobStages.jobStageDetails, unknown, "java"); diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/main.tsp b/tests-upgrade/tests-emitter/DataBox.Management.brown/main.tsp new file mode 100644 index 00000000000..7b6a8f3f07e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/main.tsp @@ -0,0 +1,59 @@ +/** + * PLEASE DO NOT REMOVE - USED FOR CONVERTER METRICS + * Generated by package: @autorest/openapi-to-typespec + * Parameters used: + * isFullCompatible: true + * guessResourceKey: false + * Version: 0.10.14 + * Date: 2025-07-30T02:19:46.367Z + */ +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "./models.tsp"; +import "./JobResource.tsp"; +import "./routes.tsp"; +import "./back-compatible.tsp"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using Azure.ResourceManager.Foundations; +using Azure.Core; +using Azure.ResourceManager; +using TypeSpec.Versioning; + +@armProviderNamespace +@service(#{ title: "DataBoxManagementClient" }) +@versioned(Versions) +// FIXME: Common type version not set. Set to v3. +@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) +namespace Microsoft.DataBox; + +/** + * The available API versions. + */ +enum Versions { + /** + * The 2025-07-01 API version. + */ + v2025_07_01: "2025-07-01", +} + +interface Operations { + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @tag("Operations") + @autoRoute + @doc("List the operations for the provider") + @segment("operations") + @get + @list + list( + ...ApiVersionParameter, + + @path + @segment("providers") + @doc("The provider namespace (this parameter will not show up in operations).") + provider: "Microsoft.ThisWillBeReplaced", + ): ArmResponse | ApiError; +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/models.tsp b/tests-upgrade/tests-emitter/DataBox.Management.brown/models.tsp new file mode 100644 index 00000000000..f8e11e74cfc --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/models.tsp @@ -0,0 +1,4283 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; + +using Azure.ResourceManager; +using Azure.ResourceManager.Foundations; + +namespace Microsoft.DataBox; + +/** + * Name of the stage which is in progress. + */ +union StageName { + string, + + /** + * An order has been created. + */ + DeviceOrdered: "DeviceOrdered", + + /** + * A device has been prepared for the order. + */ + DevicePrepared: "DevicePrepared", + + /** + * Device has been dispatched to the user of the order. + */ + Dispatched: "Dispatched", + + /** + * Device has been delivered to the user of the order. + */ + Delivered: "Delivered", + + /** + * Device has been picked up from user and in transit to Azure datacenter. + */ + PickedUp: "PickedUp", + + /** + * Device has been received at Azure datacenter from the user. + */ + AtAzureDC: "AtAzureDC", + + /** + * Data copy from the device at Azure datacenter. + */ + DataCopy: "DataCopy", + + /** + * Order has completed. + */ + Completed: "Completed", + + /** + * Order has completed with errors. + */ + CompletedWithErrors: "CompletedWithErrors", + + /** + * Order has been cancelled. + */ + Cancelled: "Cancelled", + + /** + * Order has failed due to issue reported by user. + */ + Failed_IssueReportedAtCustomer: "Failed_IssueReportedAtCustomer", + + /** + * Order has failed due to issue detected at Azure datacenter. + */ + Failed_IssueDetectedAtAzureDC: "Failed_IssueDetectedAtAzureDC", + + /** + * Order has been aborted. + */ + Aborted: "Aborted", + + /** + * Order has completed with warnings. + */ + CompletedWithWarnings: "CompletedWithWarnings", + + /** + * Device is ready to be handed to customer from Azure DC. + */ + ReadyToDispatchFromAzureDC: "ReadyToDispatchFromAzureDC", + + /** + * Device can be dropped off at Azure DC. + */ + ReadyToReceiveAtAzureDC: "ReadyToReceiveAtAzureDC", + + /** + * Job created by the customer. + */ + Created: "Created", + + /** + * User shipped the device to AzureDC. + */ + ShippedToAzureDC: "ShippedToAzureDC", + + /** + * Awaiting shipment details of device from customer. + */ + AwaitingShipmentDetails: "AwaitingShipmentDetails", + + /** + * Preparing the device to ship to customer. + */ + PreparingToShipFromAzureDC: "PreparingToShipFromAzureDC", + + /** + * Shipped the device to customer. + */ + ShippedToCustomer: "ShippedToCustomer", +} + +/** + * Status of notification + */ +union DelayNotificationStatus { + string, + + /** + * Delay is still active + */ + Active: "Active", + + /** + * Delay has been resolved + */ + Resolved: "Resolved", +} + +/** + * Delay Error code + */ +union PortalDelayErrorCode { + string, + + /** + * Delay due to any internal reasons + */ + InternalIssueDelay: "InternalIssueDelay", + + /** + * Active Order limit breached. + */ + ActiveOrderLimitBreachedDelay: "ActiveOrderLimitBreachedDelay", + + /** + * High demand + */ + HighDemandDelay: "HighDemandDelay", + + /** + * Slow copy due to large number of files + */ + LargeNumberOfFilesDelay: "LargeNumberOfFilesDelay", +} + +/** + * Name of the stage. + */ +union NotificationStageName { + string, + + /** + * Notification at device prepared stage. + */ + DevicePrepared: "DevicePrepared", + + /** + * Notification at device dispatched stage. + */ + Dispatched: "Dispatched", + + /** + * Notification at device delivered stage. + */ + Delivered: "Delivered", + + /** + * Notification at device picked up from user stage. + */ + PickedUp: "PickedUp", + + /** + * Notification at device received at Azure datacenter stage. + */ + AtAzureDC: "AtAzureDC", + + /** + * Notification at data copy started stage. + */ + DataCopy: "DataCopy", + + /** + * Notification at job created stage. + */ + Created: "Created", + + /** + * Notification at shipped devices to customer stage. + */ + ShippedToCustomer: "ShippedToCustomer", +} + +/** + * DataCenter code. + */ +union DataCenterCode { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Invalid: "Invalid", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BY2: "BY2", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BY1: "BY1", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ORK70: "ORK70", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AM2: "AM2", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AMS20: "AMS20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BY21: "BY21", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BY24: "BY24", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + MWH01: "MWH01", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AMS06: "AMS06", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SSE90: "SSE90", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SYD03: "SYD03", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SYD23: "SYD23", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + CBR20: "CBR20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + YTO20: "YTO20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + CWL20: "CWL20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + LON24: "LON24", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BOM01: "BOM01", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BL20: "BL20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BL7: "BL7", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SEL20: "SEL20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + TYO01: "TYO01", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BN1: "BN1", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SN5: "SN5", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + CYS04: "CYS04", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + TYO22: "TYO22", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + YTO21: "YTO21", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + YQB20: "YQB20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + FRA22: "FRA22", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + MAA01: "MAA01", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + CPQ02: "CPQ02", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + CPQ20: "CPQ20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SIN20: "SIN20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + HKG20: "HKG20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SG2: "SG2", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + MEL23: "MEL23", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SEL21: "SEL21", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + OSA20: "OSA20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SHA03: "SHA03", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BJB: "BJB", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + JNB22: "JNB22", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + JNB21: "JNB21", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + MNZ21: "MNZ21", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SN8: "SN8", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AUH20: "AUH20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ZRH20: "ZRH20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + PUS20: "PUS20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AdHoc: "AdHoc", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + CH1: "CH1", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + DSM05: "DSM05", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + DUB07: "DUB07", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + PNQ01: "PNQ01", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SVG20: "SVG20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + OSA02: "OSA02", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + OSA22: "OSA22", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + PAR22: "PAR22", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BN7: "BN7", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SN6: "SN6", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BJS20: "BJS20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + BL24: "BL24", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + IDC5: "IDC5", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + TYO23: "TYO23", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + NTG20: "NTG20", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + DXB23: "DXB23", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + DSM11: "DSM11", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + AMS25: "AMS25", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + CPQ21: "CPQ21", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + OSA23: "OSA23", +} + +/** + * The Status of the copy + */ +union CopyStatus { + string, + + /** + * Data copy hasn't started yet. + */ + NotStarted: "NotStarted", + + /** + * Data copy is in progress. + */ + InProgress: "InProgress", + + /** + * Data copy completed. + */ + Completed: "Completed", + + /** + * Data copy completed with errors. + */ + CompletedWithErrors: "CompletedWithErrors", + + /** + * Data copy failed. No data was copied. + */ + Failed: "Failed", + + /** + * No copy triggered as device was not returned. + */ + NotReturned: "NotReturned", + + /** + * The Device has hit hardware issues. + */ + HardwareError: "HardwareError", + + /** + * Data copy failed. The Device was formatted by user. + */ + DeviceFormatted: "DeviceFormatted", + + /** + * Data copy failed. Device metadata was modified by user. + */ + DeviceMetadataModified: "DeviceMetadataModified", + + /** + * Data copy failed. Storage Account was not accessible during copy. + */ + StorageAccountNotAccessible: "StorageAccountNotAccessible", + + /** + * Data copy failed. The Device data content is not supported. + */ + UnsupportedData: "UnsupportedData", + + /** + * No copy triggered as device was not received. + */ + DriveNotReceived: "DriveNotReceived", + + /** + * No copy triggered as device type is not supported. + */ + UnsupportedDrive: "UnsupportedDrive", + + /** + * Copy failed due to service error. + */ + OtherServiceError: "OtherServiceError", + + /** + * Copy failed due to user error. + */ + OtherUserError: "OtherUserError", + + /** + * Copy failed due to disk detection error. + */ + DriveNotDetected: "DriveNotDetected", + + /** + * Copy failed due to corrupted drive. + */ + DriveCorrupted: "DriveCorrupted", + + /** + * Copy failed due to modified or removed metadata files. + */ + MetadataFilesModifiedOrRemoved: "MetadataFilesModifiedOrRemoved", +} + +/** + * Type of the transfer. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum TransferType { + /** + * Import data to azure. + */ + ImportToAzure, + + /** + * Export data from azure. + */ + ExportFromAzure, +} + +/** + * The Editable status for Reverse Shipping Address and Contact Info + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum ReverseShippingDetailsEditStatus { + /** + * Reverse shipping details can be edited. + */ + Enabled, + + /** + * Edit is disabled for Reverse shipping details. + */ + Disabled, + + /** + * Edit is not supported for Reverse shipping details. Either subscription feature is not available or SKU doesn't support this feature. + */ + NotSupported, +} + +/** + * The Editable status for Reverse Transport preferences + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum ReverseTransportPreferenceEditStatus { + /** + * Reverse Transport Preferences can be edited. + */ + Enabled, + + /** + * Edit is disabled for Reverse Transport Preferences. + */ + Disabled, + + /** + * Edit is not supported for Reverse Transport Preferences. Either subscription feature is not available or SKU doesn't support this feature. + */ + NotSupported, +} + +/** + * Holds the device erasure completion status + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum StageStatus { + /** + * No status available yet. + */ + None, + + /** + * Stage is in progress. + */ + InProgress, + + /** + * Stage has succeeded. + */ + Succeeded, + + /** + * Stage has failed. + */ + Failed, + + /** + * Stage has been cancelled. + */ + Cancelled, + + /** + * Stage is cancelling. + */ + Cancelling, + + /** + * Stage has succeeded with errors. + */ + SucceededWithErrors, + + /** + * Stage is stuck until customer takes some action. + */ + WaitingForCustomerAction, + + /** + * Stage has succeeded with warnings. + */ + SucceededWithWarnings, + + /** + * Stage is waiting for customer action for kek action items. + */ + WaitingForCustomerActionForKek, + + /** + * Stage is waiting for customer action for clean up. + */ + WaitingForCustomerActionForCleanUp, + + /** + * Stage has performed customer action for clean up. + */ + CustomerActionPerformedForCleanUp, + + /** + * Stage has performed customer action for clean up. + */ + CustomerActionPerformed, +} + +/** + * Type of address. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum AddressType { + /** + * Address type not known. + */ + None, + + /** + * Residential Address. + */ + Residential, + + /** + * Commercial Address. + */ + Commercial, +} + +/** + * Type of the account. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum DataAccountType { + /** + * Storage Accounts . + */ + StorageAccount, + + /** + * Azure Managed disk storage. + */ + ManagedDisk, +} + +/** + * Level of the logs to be collected. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum LogCollectionLevel { + /** + * Only Errors will be collected in the logs. + */ + Error, + + /** + * Verbose logging (includes Errors, CRC, size information and others). + */ + Verbose, +} + +/** + * Type of the configuration for transfer. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum TransferConfigurationType { + /** + * Transfer all the data. + */ + TransferAll, + + /** + * Transfer using filter. + */ + TransferUsingFilter, +} + +/** + * Type of the filter file. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum FilterFileType { + /** + * Filter file is of the type AzureBlob. + */ + AzureBlob, + + /** + * Filter file is of the type AzureFiles. + */ + AzureFile, +} + +/** + * Indicates the type of job details. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum ClassDiscriminator { + /** + * Data Box orders. + */ + DataBox, + + /** + * Data Box Disk orders. + */ + DataBoxDisk, + + /** + * Data Box Heavy orders. + */ + DataBoxHeavy, + + /** + * Data Box Customer Disk orders. + */ + DataBoxCustomerDisk, +} + +/** + * Transport Shipment Type supported for given region. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum TransportShipmentTypes { + /** + * Shipment Logistics is handled by the customer. + */ + CustomerManaged, + + /** + * Shipment Logistics is handled by Microsoft. + */ + MicrosoftManaged, +} + +/** + * Defines secondary layer of software-based encryption enablement. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum DoubleEncryption { + /** + * Software-based encryption is enabled. + */ + Enabled, + + /** + * Software-based encryption is disabled. + */ + Disabled, +} + +/** + * Hardware encryption support for a given sku for a given region. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum HardwareEncryption { + /** + * Hardware-based encryption is enabled. + */ + Enabled, + + /** + * Hardware-based encryption is disabled. + */ + Disabled, +} + +/** + * Type of encryption key used for key encryption. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum KekType { + /** + * Key encryption key is managed by Microsoft. + */ + MicrosoftManaged, + + /** + * Key encryption key is managed by the Customer. + */ + CustomerManaged, +} + +/** + * Resolution code provided by customer. + */ +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum CustomerResolutionCode { + /** + * No Resolution Yet + */ + None, + + /** + * Clean the device + */ + MoveToCleanUpDevice, + + /** + * Resume the job to same stage + */ + Resume, + + /** + * Restart whole action. + */ + Restart, + + /** + * Reach out to operation for further action. + */ + ReachOutToOperation, +} + +/** + * Data center address type + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum DatacenterAddressType { + /** + * Data center address location. + */ + DatacenterAddressLocation, + + /** + * Data center address instruction. + */ + DatacenterAddressInstruction, +} + +/** + * Delivery type of Job. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum JobDeliveryType { + /** + * Non Scheduled job. + */ + NonScheduled, + + /** + * Scheduled job. + */ + Scheduled, +} + +/** + * SKU names. + */ +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum SkuName { + /** + * Data Box. + */ + DataBox, + + /** + * Data Box Disk. + */ + DataBoxDisk, + + /** + * Data Box Heavy. + */ + DataBoxHeavy, + + /** + * Data Box Customer Disk + */ + DataBoxCustomerDisk, +} + +/** + * The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum ModelName { + /** + * Data Box. + */ + DataBox, + + /** + * Data Box Disk. + */ + DataBoxDisk, + + /** + * Data Box Heavy. + */ + DataBoxHeavy, + + /** + * Data Box Customer Disk + */ + DataBoxCustomerDisk, + + /** + * Data Box V2 with 120TB usable capacity. + */ + AzureDataBox120, + + /** + * Data Box V2 with 525TB usable capacity. + */ + AzureDataBox525, +} + +/** + * Identifies the type of validation request. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum ValidationInputDiscriminator { + /** + * Identify request and response of address validation. + */ + ValidateAddress, + + /** + * Identify request and response for validation of subscription permission to create job. + */ + ValidateSubscriptionIsAllowedToCreateJob, + + /** + * Identify request and response of preference validation. + */ + ValidatePreferences, + + /** + * Identify request and response of create order limit for subscription validation. + */ + ValidateCreateOrderLimit, + + /** + * Identify request and response of active job limit for sku availability. + */ + ValidateSkuAvailability, + + /** + * Identify request and response of data transfer details validation. + */ + ValidateDataTransferDetails, +} + +/** + * The address validation status. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum AddressValidationStatus { + /** + * Address provided is valid. + */ + Valid, + + /** + * Address provided is invalid or not supported. + */ + Invalid, + + /** + * Address provided is ambiguous, please choose one of the alternate addresses returned. + */ + Ambiguous, +} + +/** + * Overall validation status. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum OverallValidationStatus { + /** + * Every input request is valid. + */ + AllValidToProceed, + + /** + * Some input requests are not valid. + */ + InputsRevisitRequired, + + /** + * Certain input validations skipped. + */ + CertainInputValidationsSkipped, +} + +/** + * Reason why the Sku is disabled. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum SkuDisabledReason { + /** + * SKU is not disabled. + */ + None, + + /** + * SKU is not available in the requested country. + */ + Country, + + /** + * SKU is not available to push data to the requested Azure region. + */ + Region, + + /** + * Required features are not enabled for the SKU. + */ + Feature, + + /** + * Subscription does not have required offer types for the SKU. + */ + OfferType, + + /** + * Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification. + */ + NoSubscriptionInfo, +} + +/** + * Type of the share. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum ShareDestinationFormatType { + /** + * Unknown format. + */ + UnknownType, + + /** + * Storsimple data format. + */ + HCS, + + /** + * Azure storage block blob format. + */ + BlockBlob, + + /** + * Azure storage page blob format. + */ + PageBlob, + + /** + * Azure storage file format. + */ + AzureFile, + + /** + * Azure Compute Disk. + */ + ManagedDisk, +} + +/** + * Access protocols supported on the device. + */ +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum AccessProtocol { + /** + * Server Message Block protocol(SMB). + */ + SMB, + + /** + * Network File System protocol(NFS). + */ + NFS, +} + +/** + * Create order limit validation status. + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum ValidationStatus { + /** + * Validation is successful + */ + Valid, + + /** + * Validation is not successful + */ + Invalid, + + /** + * Validation is skipped + */ + Skipped, +} + +/** + * Job Resource Collection + */ +model JobResourceList is Azure.Core.Page; + +/** + * Job Properties + */ +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model JobProperties { + /** + * Type of the data transfer. + */ + transferType: TransferType; + + /** + * Describes whether the job is cancellable or not. + */ + @visibility(Lifecycle.Read) + isCancellable?: boolean; + + /** + * Describes whether the job is deletable or not. + */ + @visibility(Lifecycle.Read) + isDeletable?: boolean; + + /** + * Describes whether the shipping address is editable or not. + */ + @visibility(Lifecycle.Read) + isShippingAddressEditable?: boolean; + + /** + * The Editable status for Reverse Shipping Address and Contact Info + */ + @visibility(Lifecycle.Read) + reverseShippingDetailsUpdate?: ReverseShippingDetailsEditStatus; + + /** + * The Editable status for Reverse Transport preferences + */ + @visibility(Lifecycle.Read) + reverseTransportPreferenceUpdate?: ReverseTransportPreferenceEditStatus; + + /** + * Is Prepare To Ship Enabled on this job + */ + @visibility(Lifecycle.Read) + isPrepareToShipEnabled?: boolean; + + /** + * Name of the stage which is in progress. + */ + @visibility(Lifecycle.Read) + status?: StageName; + + /** + * Name of the stage where delay might be present. + */ + @visibility(Lifecycle.Read) + delayedStage?: StageName; + + /** + * Time at which the job was started in UTC ISO 8601 format. + */ + @visibility(Lifecycle.Read) + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + startTime?: utcDateTime; + + /** + * Top level error for the job. + */ + @visibility(Lifecycle.Read) + error?: CloudError; + + /** + * Details of a job run. This field will only be sent for expand details filter. + */ + details?: JobDetails; + + /** + * Reason for cancellation. + */ + @visibility(Lifecycle.Read) + cancellationReason?: string; + + /** + * Delivery type of Job. + */ + deliveryType?: JobDeliveryType = JobDeliveryType.NonScheduled; + + /** + * Delivery Info of Job. + */ + deliveryInfo?: JobDeliveryInfo; + + /** + * Flag to indicate cancellation of scheduled job. + */ + @visibility(Lifecycle.Read) + isCancellableWithoutFee?: boolean; + + /** + * Flag to indicate if all devices associated with the job are lost. + */ + @visibility(Lifecycle.Read) + allDevicesLost?: boolean; +} + +/** + * Provides additional information about an http error response. + */ +model CloudError { + /** + * Gets or sets additional error info. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + additionalInfo?: AdditionalErrorInfo[]; + + /** + * Error code. + */ + code?: string; + + /** + * Gets or sets details for the error. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + details?: CloudError[]; + + /** + * The error message parsed from the body of the http error response. + */ + message?: string; + + /** + * Gets or sets the target of the error. + */ + target?: string; +} + +/** + * This class represents additional info which Resource Providers pass when an error occurs. + */ +model AdditionalErrorInfo { + /** + * Additional information of the type of error. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + info?: Record; + + /** + * Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation). + */ + type?: string; +} + +/** + * Job details. + */ +@discriminator("jobDetailsType") +model JobDetails { + /** + * List of stages that run in the job. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + jobStages?: JobStages[]; + + /** + * Contact details for notification and shipping. + */ + contactDetails: ContactDetails; + + /** + * Shipping address of the customer. + */ + shippingAddress?: ShippingAddress; + + /** + * Delivery package shipping details. + */ + @visibility(Lifecycle.Read) + deliveryPackage?: PackageShippingDetails; + + /** + * Return package shipping details. + */ + @visibility(Lifecycle.Read) + returnPackage?: PackageShippingDetails; + + /** + * Details of the data to be imported into azure. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + dataImportDetails?: DataImportDetails[]; + + /** + * Details of the data to be exported from azure. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + dataExportDetails?: DataExportDetails[]; + + /** + * Indicates the type of job details. + */ + #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + jobDetailsType: ClassDiscriminator; + + /** + * Preferences for the order. + */ + preferences?: Preferences; + + /** + * Optional Reverse Shipping details for order. + */ + reverseShippingDetails?: ReverseShippingDetails; + + /** + * List of copy log details. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + copyLogDetails?: CopyLogDetails[]; + + /** + * Shared access key to download the return shipment label + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @visibility(Lifecycle.Read) + reverseShipmentLabelSasKey?: string; + + /** + * Shared access key to download the chain of custody logs + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @visibility(Lifecycle.Read) + chainOfCustodySasKey?: string; + + /** + * Holds device data erasure details + */ + @visibility(Lifecycle.Read) + deviceErasureDetails?: DeviceErasureDetails; + + /** + * Details about which key encryption type is being used. + */ + keyEncryptionKey?: KeyEncryptionKey; + + /** + * The expected size of the data, which needs to be transferred in this job, in terabytes. + */ + expectedDataSizeInTeraBytes?: int32; + + /** + * Available actions on the job. + */ + @visibility(Lifecycle.Read) + actions?: CustomerResolutionCode[]; + + /** + * Last mitigation action performed on the job. + */ + @visibility(Lifecycle.Read) + lastMitigationActionOnJob?: LastMitigationActionOnJob; + + /** + * Datacenter address to ship to, for the given sku and storage location. + */ + @visibility(Lifecycle.Read) + datacenterAddress?: DatacenterAddressResponse; + + /** + * DataCenter code. + */ + @visibility(Lifecycle.Read) + dataCenterCode?: DataCenterCode; +} + +/** + * Job stages. + */ +model JobStages { + /** + * Name of the job stage. + */ + @visibility(Lifecycle.Read) + stageName?: StageName; + + /** + * Display name of the job stage. + */ + @visibility(Lifecycle.Read) + displayName?: string; + + /** + * Status of the job stage. + */ + @visibility(Lifecycle.Read) + stageStatus?: StageStatus; + + /** + * Time for the job stage in UTC ISO 8601 format. + */ + @visibility(Lifecycle.Read) + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + stageTime?: utcDateTime; + + /** + * Job Stage Details + */ + #suppress "@azure-tools/typespec-azure-core/no-unknown" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + jobStageDetails?: unknown; + + /** + * Delay information for the job stages. + */ + @visibility(Lifecycle.Read) + @identifiers(#[]) + delayInformation?: JobDelayDetails[]; +} + +/** + * Job Delay Notification details + */ +model JobDelayDetails { + /** + * Status of notification + */ + @visibility(Lifecycle.Read) + status?: DelayNotificationStatus; + + /** + * Delay Error code + */ + @visibility(Lifecycle.Read) + errorCode?: PortalDelayErrorCode; + + /** + * Description of the delay. + */ + @visibility(Lifecycle.Read) + description?: string; + + /** + * Timestamp when the delay notification was created. + */ + @visibility(Lifecycle.Read) + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + startTime?: utcDateTime; + + /** + * Timestamp when the delay notification was resolved. + */ + @visibility(Lifecycle.Read) + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + resolutionTime?: utcDateTime; +} + +/** + * Contact Details. + */ +model ContactDetails { + /** + * Contact name of the person. + */ + contactName: string; + + /** + * Phone number of the contact person. + */ + phone: string; + + /** + * Phone extension number of the contact person. + */ + phoneExtension?: string; + + /** + * Mobile number of the contact person. + */ + mobile?: string; + + /** + * List of Email-ids to be notified about job progress. + */ + emailList: string[]; + + /** + * Notification preference for a job stage. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + notificationPreference?: NotificationPreference[]; +} + +/** + * Notification preference for a job stage. + */ +model NotificationPreference { + /** + * Name of the stage. + */ + stageName: NotificationStageName; + + /** + * Notification is required or not. + */ + sendNotification: boolean = true; +} + +/** + * Shipping address where customer wishes to receive the device. + */ +model ShippingAddress { + /** + * Street Address line 1. + */ + streetAddress1: string; + + /** + * Street Address line 2. + */ + streetAddress2?: string; + + /** + * Street Address line 3. + */ + streetAddress3?: string; + + /** + * Name of the City. + */ + city?: string; + + /** + * Name of the State or Province. + */ + stateOrProvince?: string; + + /** + * Name of the Country. + */ + country: string; + + /** + * Postal code. + */ + postalCode?: string; + + /** + * Extended Zip Code. + */ + zipExtendedCode?: string; + + /** + * Name of the company. + */ + companyName?: string; + + /** + * Type of address. + */ + addressType?: AddressType = AddressType.None; + + /** + * Flag to indicate if customer has chosen to skip default address validation + */ + skipAddressValidation?: boolean; + + /** + * Tax Identification Number + */ + taxIdentificationNumber?: string; +} + +/** + * package shipping details + */ +model PackageShippingDetails { + /** + * Url where shipment can be tracked. + */ + @visibility(Lifecycle.Read) + trackingUrl?: string; + + /** + * Name of the carrier. + */ + @visibility(Lifecycle.Read) + carrierName?: string; + + /** + * Tracking Id of shipment. + */ + @visibility(Lifecycle.Read) + trackingId?: string; +} + +/** + * Details of the data to be used for importing data to azure. + */ +model DataImportDetails { + /** + * Account details of the data to be transferred + */ + accountDetails: DataAccountDetails; + + /** + * Level of the logs to be collected. + */ + logCollectionLevel?: LogCollectionLevel = LogCollectionLevel.Error; +} + +/** + * Account details of the data to be transferred + */ +@discriminator("dataAccountType") +model DataAccountDetails { + /** + * Account Type of the data to be transferred. + */ + #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + dataAccountType: DataAccountType = DataAccountType.StorageAccount; + + @doc("Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+") + @visibility(Lifecycle.Create) + @secret + sharePassword?: string; +} + +/** + * Details of the data to be used for exporting data from azure. + */ +model DataExportDetails { + /** + * Configuration for the data transfer. + */ + transferConfiguration: TransferConfiguration; + + /** + * Level of the logs to be collected. + */ + logCollectionLevel?: LogCollectionLevel = LogCollectionLevel.Error; + + /** + * Account details of the data to be transferred + */ + accountDetails: DataAccountDetails; +} + +/** + * Configuration for defining the transfer of data. + */ +model TransferConfiguration { + /** + * Type of the configuration for transfer. + */ + transferConfigurationType: TransferConfigurationType; + + /** + * Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter. + */ + transferFilterDetails?: TransferConfigurationTransferFilterDetails; + + /** + * Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll + */ + transferAllDetails?: TransferConfigurationTransferAllDetails; +} + +/** + * Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter. + */ +model TransferConfigurationTransferFilterDetails { + /** + * Details of the filtering the transfer of data. + */ + include?: TransferFilterDetails; +} + +/** + * Details of the filtering the transfer of data. + */ +model TransferFilterDetails { + /** + * Type of the account of data. + */ + dataAccountType: DataAccountType = DataAccountType.StorageAccount; + + /** + * Filter details to transfer blobs. + */ + blobFilterDetails?: BlobFilterDetails; + + /** + * Filter details to transfer Azure files. + */ + azureFileFilterDetails?: AzureFileFilterDetails; + + /** + * Details of the filter files to be used for data transfer. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + filterFileDetails?: FilterFileDetails[]; +} + +/** + * Filter details to transfer Azure Blobs + */ +model BlobFilterDetails { + /** + * Prefix list of the Azure blobs to be transferred. + */ + blobPrefixList?: string[]; + + /** + * List of full path of the blobs to be transferred. + */ + blobPathList?: string[]; + + /** + * List of blob containers to be transferred. + */ + containerList?: string[]; +} + +/** + * Filter details to transfer Azure files + */ +model AzureFileFilterDetails { + /** + * Prefix list of the Azure files to be transferred. + */ + filePrefixList?: string[]; + + /** + * List of full path of the files to be transferred. + */ + filePathList?: string[]; + + /** + * List of file shares to be transferred. + */ + fileShareList?: string[]; +} + +/** + * Details of the filter files to be used for data transfer. + */ +model FilterFileDetails { + /** + * Type of the filter file. + */ + filterFileType: FilterFileType; + + /** + * Path of the file that contains the details of all items to transfer. + */ + filterFilePath: string; +} + +/** + * Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll + */ +model TransferConfigurationTransferAllDetails { + /** + * Details to transfer all data. + */ + include?: TransferAllDetails; +} + +/** + * Details to transfer all data. + */ +model TransferAllDetails { + /** + * Type of the account of data + */ + dataAccountType: DataAccountType = DataAccountType.StorageAccount; + + /** + * To indicate if all Azure blobs have to be transferred + */ + transferAllBlobs?: boolean; + + /** + * To indicate if all Azure Files have to be transferred + */ + transferAllFiles?: boolean; +} + +/** + * Preferences related to the order + */ +model Preferences { + /** + * Preferred data center region. + */ + preferredDataCenterRegion?: string[]; + + /** + * Preferences related to the shipment logistics of the sku. + */ + transportPreferences?: TransportPreferences; + + /** + * Optional Preferences related to the reverse shipment logistics of the sku. + */ + reverseTransportPreferences?: TransportPreferences; + + /** + * Preferences related to the Encryption. + */ + encryptionPreferences?: EncryptionPreferences; + + /** + * Preferences related to the Access Tier of storage accounts. + */ + storageAccountAccessTierPreferences?: "Archive"[]; // FIXME: `modelAsExtensible` is not supported anymore. +} + +/** + * Preferences related to the shipment logistics of the sku + */ +model TransportPreferences { + /** + * Indicates Shipment Logistics type that the customer preferred. + */ + preferredShipmentType: TransportShipmentTypes; + + /** + * Read only property which indicates whether transport preferences has been updated or not after device is prepared. + */ + @visibility(Lifecycle.Read) + isUpdated?: boolean; +} + +/** + * Preferences related to the Encryption. + */ +model EncryptionPreferences { + /** + * Defines secondary layer of software-based encryption enablement. + */ + doubleEncryption?: DoubleEncryption = DoubleEncryption.Disabled; + + /** + * Defines Hardware level encryption (Only for disk) + */ + hardwareEncryption?: HardwareEncryption; +} + +/** + * Reverse Shipping Address and contact details for a job. + */ +model ReverseShippingDetails { + /** + * Contact Info. + */ + contactDetails?: ContactInfo; + + /** + * Shipping address where customer wishes to receive the device. + */ + shippingAddress?: ShippingAddress; + + /** + * A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + * Read only field + */ + @visibility(Lifecycle.Read) + isUpdated?: boolean; +} + +/** + * Contact Info. + */ +model ContactInfo { + /** + * Contact name of the person. + */ + @minLength(1) + contactName: string; + + /** + * Phone number of the contact person. + */ + @minLength(1) + phone: string; + + /** + * Phone extension number of the contact person. + */ + phoneExtension?: string; + + /** + * Mobile number of the contact person. + */ + mobile?: string; +} + +/** + * Details for log generated during copy. + */ +@discriminator("copyLogDetailsType") +model CopyLogDetails { + /** + * Indicates the type of job details. + */ + #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + copyLogDetailsType: ClassDiscriminator; +} + +/** + * Device erasure details with erasure completion status, secure erasure sas key and erasureordestructionlog sas key + */ +model DeviceErasureDetails { + /** + * Holds the device erasure completion status + */ + @visibility(Lifecycle.Read) + deviceErasureStatus?: StageStatus; + + /** + * Shared access key to download cleanup or destruction certificate for device + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @visibility(Lifecycle.Read) + erasureOrDestructionCertificateSasKey?: string; + + /** + * Shared access key to download secure erasure certificate for the device + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @visibility(Lifecycle.Read) + secureErasureCertificateSasKey?: string; +} + +/** + * Encryption key containing details about key to encrypt different keys. + */ +model KeyEncryptionKey { + /** + * Type of encryption key used for key encryption. + */ + kekType: KekType = KekType.MicrosoftManaged; + + /** + * Managed identity properties used for key encryption. + */ + identityProperties?: IdentityProperties; + + /** + * Key encryption key. It is required in case of Customer managed KekType. + */ + kekUrl?: string; + + /** + * Kek vault resource id. It is required in case of Customer managed KekType. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + kekVaultResourceID?: string; +} + +/** + * Managed identity properties. + */ +model IdentityProperties { + /** + * Managed service identity type. + */ + type?: string; + + /** + * User assigned identity properties. + */ + userAssigned?: UserAssignedProperties; +} + +/** + * User assigned identity properties. + */ +model UserAssignedProperties { + /** + * Arm resource id for user assigned identity to be used to fetch MSI token. + */ + resourceId?: string; +} + +/** + * Last Mitigation Action Performed On Job + */ +model LastMitigationActionOnJob { + /** + * Action performed date time + */ + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + actionDateTimeInUtc?: utcDateTime; + + /** + * Action performed by customer, + * possibility is that mitigation might happen by customer or service or by ops + */ + isPerformedByCustomer?: boolean; + + /** + * Resolution code provided by customer + */ + customerResolution?: CustomerResolutionCode; +} + +/** + * Datacenter address for given storage location. + */ +@discriminator("datacenterAddressType") +model DatacenterAddressResponse { + /** + * Data center address type + */ + #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + datacenterAddressType: DatacenterAddressType; + + /** + * List of supported carriers for return shipment. + */ + @visibility(Lifecycle.Read) + supportedCarriersForReturnShipment?: string[]; + + /** + * Azure Location where the Data Center serves primarily. + */ + @visibility(Lifecycle.Read) + dataCenterAzureLocation?: string; +} + +/** + * Additional delivery info. + */ +model JobDeliveryInfo { + /** + * Scheduled date time. + */ + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + scheduledDateTime?: utcDateTime; +} + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model Details { + /** + * Error code. + */ + code: string; + + /** + * Error message. + */ + message: string; +} + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model ErrorDetail { + /** + * Error code. + */ + code: string; + + /** + * Error message. + */ + message: string; + + /** + * Error target. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + details?: Details[]; + + /** + * Additional error info. + */ + target?: string; +} + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@error +model ApiError { + /** + * The error detail. + */ + error: ErrorDetail; +} + +/** + * Request body to get the configuration for the region. + */ +model RegionConfigurationRequest { + /** + * Request body to get the availability for scheduling orders. + */ + scheduleAvailabilityRequest?: ScheduleAvailabilityRequest; + + /** + * Request body to get the transport availability for given sku. + */ + transportAvailabilityRequest?: TransportAvailabilityRequest; + + /** + * Request body to get the datacenter address for given sku. + */ + datacenterAddressRequest?: DatacenterAddressRequest; + + /** + * Request body to get the device capabilities for a given sku. + */ + deviceCapabilityRequest?: DeviceCapabilityRequest; +} + +/** + * Request body to get the availability for scheduling orders. + */ +@discriminator("skuName") +model ScheduleAvailabilityRequest { + /** + * Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + */ + storageLocation: string; + + /** + * Sku Name for which the order is to be scheduled. + */ + #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + skuName: SkuName; + + /** + * Country in which storage location should be supported. + */ + country?: string; + + /** + * The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + */ + `model`?: ModelName; +} + +/** + * Request body to get the transport availability for given sku. + */ +model TransportAvailabilityRequest { + /** + * Type of the device. + */ + skuName?: SkuName; + + /** + * The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + */ + `model`?: ModelName; +} + +/** + * Request body to get the datacenter address. + */ +model DatacenterAddressRequest { + /** + * Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + */ + storageLocation: string; + + /** + * Sku Name for which the data center address requested. + */ + skuName: SkuName; + + /** + * The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + */ + `model`?: ModelName; +} + +/** + * Request body to get the device capabilities for given sku. + */ +model DeviceCapabilityRequest { + /** + * Type of the device. + */ + skuName?: SkuName; + + /** + * The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + */ + `model`?: ModelName; +} + +/** + * Configuration response specific to a region. + */ +model RegionConfigurationResponse { + /** + * Schedule availability for given sku in a region. + */ + @visibility(Lifecycle.Read) + scheduleAvailabilityResponse?: ScheduleAvailabilityResponse; + + /** + * Transport options available for given sku in a region. + */ + @visibility(Lifecycle.Read) + transportAvailabilityResponse?: TransportAvailabilityResponse; + + /** + * Datacenter address for given sku in a region. + */ + @visibility(Lifecycle.Read) + datacenterAddressResponse?: DatacenterAddressResponse; + + /** + * Device capabilities available for a given sku in a region. + */ + @visibility(Lifecycle.Read) + deviceCapabilityResponse?: DeviceCapabilityResponse; +} + +/** + * Schedule availability for given sku in a region. + */ +model ScheduleAvailabilityResponse { + /** + * List of dates available to schedule + */ + @visibility(Lifecycle.Read) + availableDates?: utcDateTime[]; +} + +/** + * Transport options available for given sku in a region. + */ +model TransportAvailabilityResponse { + /** + * List of transport availability details for given region + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + transportAvailabilityDetails?: TransportAvailabilityDetails[]; +} + +/** + * Transport options availability details for given region. + */ +model TransportAvailabilityDetails { + /** + * Transport Shipment Type supported for given region. + */ + @visibility(Lifecycle.Read) + shipmentType?: TransportShipmentTypes; +} + +/** + * Device capabilities for given sku in a region + */ +model DeviceCapabilityResponse { + /** + * List of device capabilities available for a given region and a given sku + */ + @visibility(Lifecycle.Read) + @identifiers(#[]) + deviceCapabilityDetails?: DeviceCapabilityDetails[]; +} + +/** + * Device capability details for a given sku for a given region. + */ +model DeviceCapabilityDetails { + /** + * Hardware encryption support for a given sku for a given region. + */ + @visibility(Lifecycle.Read) + hardwareEncryption?: HardwareEncryption; +} + +/** + * The requirements to validate customer address where the device needs to be shipped. + */ +model ValidateAddress extends ValidationInputRequest { + /** + * Shipping address of the customer. + */ + shippingAddress: ShippingAddress; + + /** + * Device type to be used for the job. + */ + deviceType: SkuName; + + /** + * Preferences related to the shipment logistics of the sku. + */ + transportPreferences?: TransportPreferences; + + /** + * The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + */ + `model`?: ModelName; + + /** + * Identifies the type of validation request. + */ + validationType: ValidationInputDiscriminator.ValidateAddress; +} + +/** + * Minimum fields that must be present in any type of validation request. + */ +@discriminator("validationType") +model ValidationInputRequest { + /** + * Identifies the type of validation request. + */ + #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + validationType: ValidationInputDiscriminator; +} + +/** + * Output of the address validation api. + */ +model AddressValidationOutput { + /** + * The address validation properties. + */ + @visibility(Lifecycle.Read) + properties?: AddressValidationProperties; +} + +/** + * The address validation output. + */ +model AddressValidationProperties extends ValidationInputResponse { + /** + * The address validation status. + */ + @visibility(Lifecycle.Read) + validationStatus?: AddressValidationStatus; + + /** + * List of alternate addresses. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + alternateAddresses?: ShippingAddress[]; + + /** + * Identifies the type of validation response. + */ + validationType: ValidationInputDiscriminator.ValidateAddress; +} + +/** + * Minimum properties that should be present in each individual validation response. + */ +@discriminator("validationType") +model ValidationInputResponse { + /** + * Identifies the type of validation response. + */ + #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + validationType: ValidationInputDiscriminator; + + /** + * Error code and message of validation response. + */ + @visibility(Lifecycle.Read) + error?: CloudError; +} + +/** + * Minimum request requirement of any validation category. + */ +@discriminator("validationCategory") +model ValidationRequest { + /** + * Identify the nature of validation. + */ + #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + validationCategory: "JobCreationValidation"; // FIXME: `modelAsExtensible` is not supported anymore. + + /** + * List of request details contain validationType and its request as key and value respectively. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + individualRequestDetails: ValidationInputRequest[]; +} + +/** + * Response of pre job creation validations. + */ +model ValidationResponse { + /** + * Properties of pre job creation validation response. + */ + @visibility(Lifecycle.Read) + properties?: ValidationResponseProperties; +} + +/** + * Properties of pre job creation validation response. + */ +model ValidationResponseProperties { + /** + * Overall validation status. + */ + @visibility(Lifecycle.Read) + status?: OverallValidationStatus; + + /** + * List of response details contain validationType and its response as key and value respectively. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + individualResponseDetails?: ValidationInputResponse[]; +} + +/** + * The JobResourceUpdateParameter. + */ +#suppress "@azure-tools/typespec-azure-resource-manager/patch-envelope" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model JobResourceUpdateParameter { + /** + * Properties of a job to be updated. + */ + properties?: UpdateJobProperties; + + /** + * The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + tags?: Record; + + /** + * Msi identity of the resource + */ + identity?: ResourceIdentity; +} + +/** + * Job Properties for update + */ +model UpdateJobProperties { + /** + * Details of a job to be updated. + */ + details?: UpdateJobDetails; +} + +/** + * Job details for update. + */ +model UpdateJobDetails { + /** + * Contact details for notification and shipping. + */ + contactDetails?: ContactDetails; + + /** + * Shipping address of the customer. + */ + shippingAddress?: ShippingAddress; + + /** + * Reverse Shipping Address and contact details for a job. + */ + reverseShippingDetails?: ReverseShippingDetails; + + /** + * Preferences related to the order + */ + preferences?: Preferences; + + /** + * Key encryption key for the job. + */ + keyEncryptionKey?: KeyEncryptionKey; + + /** + * Return package details of job. + */ + returnToCustomerPackageDetails?: PackageCarrierDetails; +} + +/** + * Package carrier details. + */ +model PackageCarrierDetails { + /** + * Carrier Account Number of customer for customer disk. + */ + @secret + carrierAccountNumber?: string; + + /** + * Name of the carrier. + */ + carrierName?: string; + + /** + * Tracking Id of shipment. + */ + trackingId?: string; +} + +/** + * Msi identity details of the resource + */ +model ResourceIdentity { + /** + * Identity type + */ + type?: string = "None"; + + /** + * Service Principal Id backing the Msi + */ + @visibility(Lifecycle.Read) + principalId?: string; + + /** + * Home Tenant Id + */ + @visibility(Lifecycle.Read) + tenantId?: string; + + /** + * User Assigned Identities + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + userAssignedIdentities?: Record; +} + +/** + * Shipment pick up request details. + */ +model ShipmentPickUpRequest { + /** + * Minimum date after which the pick up should commence, this must be in local time of pick up area. + */ + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + startTime: utcDateTime; + + /** + * Maximum date before which the pick up should commence, this must be in local time of pick up area. + */ + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + endTime: utcDateTime; + + /** + * Shipment Location in the pickup place. Eg.front desk + */ + shipmentLocation: string; +} + +/** + * Shipment pick up response. + */ +model ShipmentPickUpResponse { + /** + * Confirmation number for the pick up request. + */ + @visibility(Lifecycle.Read) + confirmationNumber?: string; + + /** + * Time by which shipment should be ready for pick up, this is in local time of pick up area. + */ + @visibility(Lifecycle.Read) + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + readyByTime?: utcDateTime; +} + +/** + * Reason for cancellation. + */ +model CancellationReason { + /** + * Reason for cancellation. + */ + reason: string; +} + +/** + * List of unencrypted credentials for accessing device. + */ +model UnencryptedCredentialsList is Azure.Core.Page; + +/** + * Unencrypted credentials for accessing device. + */ +model UnencryptedCredentials { + /** + * Name of the job. + */ + @visibility(Lifecycle.Read) + jobName?: string; + + /** + * Secrets related to this job. + */ + @visibility(Lifecycle.Read) + jobSecrets?: JobSecrets; +} + +/** + * The base class for the secrets + */ +@discriminator("jobSecretsType") +model JobSecrets { + /** + * Used to indicate what type of job secrets object. + */ + #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + jobSecretsType: ClassDiscriminator; + + /** + * Dc Access Security Code for Customer Managed Shipping + */ + @visibility(Lifecycle.Read) + dcAccessSecurityCode?: DcAccessSecurityCode; + + /** + * Error while fetching the secrets. + */ + @visibility(Lifecycle.Read) + error?: CloudError; +} + +/** + * Dc access security code + */ +model DcAccessSecurityCode { + /** + * Reverse Dc access security code. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + reverseDCAccessCode?: string; + + /** + * Forward Dc access security code. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + forwardDCAccessCode?: string; +} + +/** + * The request body to provide the delivery package details of job + */ +model MarkDevicesShippedRequest { + /** + * Delivery package details + */ + deliverToDcPackageDetails: PackageCarrierInfo; +} + +/** + * package carrier info + */ +model PackageCarrierInfo { + /** + * Name of the carrier. + */ + carrierName?: string; + + /** + * Tracking Id of shipment. + */ + trackingId?: string; +} + +/** + * The Mitigate Job captured from request body for Mitigate API + */ +model MitigateJobRequest { + /** + * Resolution code for the job + */ + customerResolutionCode?: CustomerResolutionCode; + + /** + * Serial number and the customer resolution code corresponding to each serial number + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + serialNumberCustomerResolutionMap?: Record; +} + +/** + * The filters for showing the available skus. + */ +model AvailableSkuRequest { + /** + * Type of the transfer. + */ + transferType: TransferType; + + /** + * ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + */ + country: string; + + /** + * Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + */ + location: string; + + /** + * Sku Names to filter for available skus + */ + skuNames?: SkuName[]; +} + +/** + * The available skus operation response. + */ +model AvailableSkusResult { + /** + * [Placeholder] Description for page model + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + @pageItems + value: SkuInformation[]; + + /** + * [Placeholder] Description for nextLink property + */ + @nextLink + nextLink?: string; +} + +/** + * Information of the sku. + */ +model SkuInformation { + /** + * The Sku. + */ + @visibility(Lifecycle.Read) + sku?: Sku; + + /** + * The sku is enabled or not. + */ + @visibility(Lifecycle.Read) + enabled?: boolean; + + /** + * Properties of the sku. + */ + @visibility(Lifecycle.Read) + properties?: SkuProperties; +} + +/** + * The Sku. + */ +model Sku { + /** + * The sku name. + */ + name: SkuName; + + /** + * The display name of the sku. + */ + displayName?: string; + + /** + * The sku family. + */ + family?: string; + + /** + * The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + */ + `model`?: ModelName; +} + +/** + * Properties of the sku. + */ +model SkuProperties { + /** + * The map of data location to service location. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + dataLocationToServiceLocationMap?: DataLocationToServiceLocationMap[]; + + /** + * Capacity of the Sku. + */ + @visibility(Lifecycle.Read) + capacity?: SkuCapacity; + + /** + * Cost of the Sku. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + costs?: SkuCost[]; + + /** + * Api versions that support this Sku. + */ + @visibility(Lifecycle.Read) + apiVersions?: string[]; + + /** + * Reason why the Sku is disabled. + */ + @visibility(Lifecycle.Read) + disabledReason?: SkuDisabledReason; + + /** + * Message for why the Sku is disabled. + */ + @visibility(Lifecycle.Read) + disabledReasonMessage?: string; + + /** + * Required feature to access the sku. + */ + @visibility(Lifecycle.Read) + requiredFeature?: string; + + /** + * List of all the Countries in the SKU specific commerce boundary + */ + @visibility(Lifecycle.Read) + countriesWithinCommerceBoundary?: string[]; +} + +/** + * Map of data location to service location + */ +model DataLocationToServiceLocationMap { + /** + * Location of the data. + */ + @visibility(Lifecycle.Read) + dataLocation?: string; + + /** + * Location of the service. + */ + @visibility(Lifecycle.Read) + serviceLocation?: string; +} + +/** + * Capacity of the sku. + */ +model SkuCapacity { + /** + * Usable capacity in TB. + */ + @visibility(Lifecycle.Read) + usable?: string; + + /** + * Maximum capacity in TB. + */ + @visibility(Lifecycle.Read) + maximum?: string; + + /** + * Maximum capacity per device in TB. + */ + @visibility(Lifecycle.Read) + individualSkuUsable?: string; +} + +/** + * Describes metadata for retrieving price info. + */ +model SkuCost { + /** + * Meter id of the Sku. + */ + @visibility(Lifecycle.Read) + meterId?: string; + + /** + * The type of the meter. + */ + @visibility(Lifecycle.Read) + meterType?: string; + + /** + * Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region. + */ + @visibility(Lifecycle.Read) + multiplier?: float64; +} + +/** + * Credential details of the account. + */ +model AccountCredentialDetails { + /** + * Name of the account. + */ + @visibility(Lifecycle.Read) + accountName?: string; + + /** + * Type of the account. + */ + @visibility(Lifecycle.Read) + dataAccountType?: DataAccountType; + + /** + * Connection string of the account endpoint to use the account as a storage endpoint on the device. + */ + @visibility(Lifecycle.Read) + accountConnectionString?: string; + + /** + * Per share level unencrypted access credentials. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + shareCredentialDetails?: ShareCredentialDetails[]; +} + +/** + * Credential details of the shares in account. + */ +model ShareCredentialDetails { + /** + * Name of the share. + */ + @visibility(Lifecycle.Read) + shareName?: string; + + /** + * Type of the share. + */ + @visibility(Lifecycle.Read) + shareType?: ShareDestinationFormatType; + + /** + * User name for the share. + */ + @visibility(Lifecycle.Read) + userName?: string; + + /** + * Password for the share. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @visibility(Lifecycle.Read) + password?: string; + + /** + * Access protocols supported on the device. + */ + @visibility(Lifecycle.Read) + supportedAccessProtocols?: AccessProtocol[]; +} + +/** + * The Network Adapter configuration of a DataBox. + */ +model ApplianceNetworkConfiguration { + /** + * Name of the network. + */ + @visibility(Lifecycle.Read) + name?: string; + + /** + * Mac Address. + */ + @visibility(Lifecycle.Read) + macAddress?: string; +} + +/** + * Base class for all objects under resource. + */ +model ArmBaseObject { + /** + * Name of the object. + */ + @visibility(Lifecycle.Read) + name?: string; + + /** + * Id of the object. + */ + @visibility(Lifecycle.Read) + id?: string; + + /** + * Type of the object. + */ + @visibility(Lifecycle.Read) + type?: string; +} + +/** + * Copy progress. + */ +model CopyProgress { + /** + * Name of the storage account. This will be empty for data account types other than storage account. + */ + @visibility(Lifecycle.Read) + storageAccountName?: string; + + /** + * Transfer type of data + */ + @visibility(Lifecycle.Read) + transferType?: TransferType; + + /** + * Data Account Type. + */ + @visibility(Lifecycle.Read) + dataAccountType?: DataAccountType; + + /** + * Id of the account where the data needs to be uploaded. + */ + @visibility(Lifecycle.Read) + accountId?: string; + + /** + * To indicate bytes transferred. + */ + @visibility(Lifecycle.Read) + bytesProcessed?: int64; + + /** + * Total amount of data to be processed by the job. + */ + @visibility(Lifecycle.Read) + totalBytesToProcess?: int64; + + /** + * Number of files processed + */ + @visibility(Lifecycle.Read) + filesProcessed?: int64; + + /** + * Total files to process + */ + @visibility(Lifecycle.Read) + totalFilesToProcess?: int64; + + /** + * Number of files not adhering to azure naming conventions which were processed by automatic renaming + */ + @visibility(Lifecycle.Read) + invalidFilesProcessed?: int64; + + /** + * Total amount of data not adhering to azure naming conventions which were processed by automatic renaming + */ + @visibility(Lifecycle.Read) + invalidFileBytesUploaded?: int64; + + /** + * Number of folders not adhering to azure naming conventions which were processed by automatic renaming + */ + @visibility(Lifecycle.Read) + renamedContainerCount?: int64; + + /** + * Number of files which could not be copied + */ + @visibility(Lifecycle.Read) + filesErroredOut?: int64; + + /** + * To indicate directories errored out in the job. + */ + @visibility(Lifecycle.Read) + directoriesErroredOut?: int64; + + /** + * To indicate directories renamed + */ + @visibility(Lifecycle.Read) + invalidDirectoriesProcessed?: int64; + + /** + * To indicate if enumeration of data is in progress. + * Until this is true, the TotalBytesToProcess may not be valid. + */ + @visibility(Lifecycle.Read) + isEnumerationInProgress?: boolean; + + /** + * Error, if any, in the stage + */ + @visibility(Lifecycle.Read) + error?: CloudError; + + /** + * Available actions on the job. + */ + @visibility(Lifecycle.Read) + actions?: CustomerResolutionCode[]; +} + +/** + * It does all pre-job creation validations. + */ +model CreateJobValidations extends ValidationRequest { + /** + * Identify the nature of validation. + */ + validationCategory: "JobCreationValidation"; // FIXME: `modelAsExtensible` is not supported anymore. +} + +/** + * Request to validate create order limit for current subscription. + */ +model CreateOrderLimitForSubscriptionValidationRequest + extends ValidationInputRequest { + /** + * Device type to be used for the job. + */ + deviceType: SkuName; + + /** + * The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + */ + `model`?: ModelName; + + /** + * Identifies the type of validation request. + */ + validationType: ValidationInputDiscriminator.ValidateCreateOrderLimit; +} + +/** + * Properties of create order limit for subscription validation response. + */ +model CreateOrderLimitForSubscriptionValidationResponseProperties + extends ValidationInputResponse { + /** + * Create order limit validation status. + */ + @visibility(Lifecycle.Read) + status?: ValidationStatus; + + /** + * Identifies the type of validation response. + */ + validationType: ValidationInputDiscriminator.ValidateCreateOrderLimit; +} + +/** + * The secrets related to customer disk job. + */ +model CustomerDiskJobSecrets extends JobSecrets { + /** + * Contains the list of secrets object for that device. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + diskSecrets?: DiskSecret[]; + + /** + * Carrier Account Number of the customer + */ + @visibility(Lifecycle.Read) + @secret + carrierAccountNumber?: string; + + /** + * Used to indicate what type of job secrets object. + */ + jobSecretsType: ClassDiscriminator.DataBoxCustomerDisk; +} + +/** + * Contains all the secrets of a Disk. + */ +model DiskSecret { + /** + * Serial number of the assigned disk. + */ + @visibility(Lifecycle.Read) + diskSerialNumber?: string; + + /** + * Bit Locker key of the disk which can be used to unlock the disk to copy data. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @visibility(Lifecycle.Read) + bitLockerKey?: string; +} + +/** + * Copy log details for a storage account of a DataBox job + */ +model DataBoxAccountCopyLogDetails extends CopyLogDetails { + /** + * Account name. + */ + @visibility(Lifecycle.Read) + accountName?: string; + + /** + * Link for copy logs. + */ + @visibility(Lifecycle.Read) + copyLogLink?: string; + + /** + * Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose. + */ + @visibility(Lifecycle.Read) + copyVerboseLogLink?: string; + + /** + * Indicates the type of job details. + */ + copyLogDetailsType: ClassDiscriminator.DataBox; +} + +/** + * Copy Log Details for customer disk + */ +model DataBoxCustomerDiskCopyLogDetails extends CopyLogDetails { + /** + * Disk Serial Number. + */ + @visibility(Lifecycle.Read) + serialNumber?: string; + + /** + * Link for copy error logs. + */ + @visibility(Lifecycle.Read) + errorLogLink?: string; + + /** + * Link for copy verbose logs. + */ + @visibility(Lifecycle.Read) + verboseLogLink?: string; + + /** + * Indicates the type of job details. + */ + copyLogDetailsType: ClassDiscriminator.DataBoxCustomerDisk; +} + +/** + * DataBox CustomerDisk Copy Progress + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model DataBoxCustomerDiskCopyProgress extends CopyProgress { + /** + * Disk Serial Number. + */ + @visibility(Lifecycle.Read) + serialNumber?: string; + + /** + * The Status of the copy + */ + @visibility(Lifecycle.Read) + copyStatus?: CopyStatus; +} + +/** + * Customer disk job details. + */ +model DataBoxCustomerDiskJobDetails extends JobDetails { + /** + * Contains the map of disk serial number to the disk details for import jobs. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + importDiskDetailsCollection?: Record; + + /** + * Contains the map of disk serial number to the disk details for export jobs. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + exportDiskDetailsCollection?: Record; + + /** + * Copy progress per disk. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + copyProgress?: DataBoxCustomerDiskCopyProgress[]; + + /** + * Delivery package shipping details. + */ + @visibility(Lifecycle.Read) + deliverToDcPackageDetails?: PackageCarrierInfo; + + /** + * Return package shipping details. + */ + returnToCustomerPackageDetails: PackageCarrierDetails; + + /** + * Flag to indicate if disk manifest should be backed-up in the Storage Account. + */ + enableManifestBackup?: boolean = false; + + /** + * Indicates the type of job details. + */ + jobDetailsType: ClassDiscriminator.DataBoxCustomerDisk; +} + +/** + * Import disk details + */ +model ImportDiskDetails { + /** + * The relative path of the manifest file on the disk. + */ + manifestFile: string; + + /** + * The Base16-encoded MD5 hash of the manifest file on the disk. + */ + manifestHash: string; + + /** + * BitLocker key used to encrypt the disk. + */ + @secret + bitLockerKey: string; + + /** + * Path to backed up manifest, only returned if enableManifestBackup is true. + */ + @visibility(Lifecycle.Read) + backupManifestCloudPath?: string; +} + +/** + * Export disk details + */ +model ExportDiskDetails { + /** + * The relative path of the manifest file on the disk. + */ + @visibility(Lifecycle.Read) + manifestFile?: string; + + /** + * The Base16-encoded MD5 hash of the manifest file on the disk. + */ + @visibility(Lifecycle.Read) + manifestHash?: string; + + /** + * Path to backed up manifest, only returned if enableManifestBackup is true. + */ + @visibility(Lifecycle.Read) + backupManifestCloudPath?: string; +} + +/** + * Copy Log Details for a disk + */ +model DataBoxDiskCopyLogDetails extends CopyLogDetails { + /** + * Disk Serial Number. + */ + @visibility(Lifecycle.Read) + diskSerialNumber?: string; + + /** + * Link for copy error logs. + */ + @visibility(Lifecycle.Read) + errorLogLink?: string; + + /** + * Link for copy verbose logs. + */ + @visibility(Lifecycle.Read) + verboseLogLink?: string; + + /** + * Indicates the type of job details. + */ + copyLogDetailsType: ClassDiscriminator.DataBoxDisk; +} + +/** + * DataBox Disk Copy Progress + */ +model DataBoxDiskCopyProgress { + /** + * The serial number of the disk + */ + @visibility(Lifecycle.Read) + serialNumber?: string; + + /** + * Bytes copied during the copy of disk. + */ + @visibility(Lifecycle.Read) + bytesCopied?: int64; + + /** + * Indicates the percentage completed for the copy of the disk. + */ + @visibility(Lifecycle.Read) + percentComplete?: int32; + + /** + * The Status of the copy + */ + @visibility(Lifecycle.Read) + status?: CopyStatus; + + /** + * Error, if any, in the stage + */ + @visibility(Lifecycle.Read) + error?: CloudError; + + /** + * Available actions on the job. + */ + @visibility(Lifecycle.Read) + actions?: CustomerResolutionCode[]; +} + +/** + * Granular Copy Log Details for customer disk + */ +model DataBoxDiskGranularCopyLogDetails extends GranularCopyLogDetails { + /** + * Disk Serial Number. + */ + @visibility(Lifecycle.Read) + serialNumber?: string; + + /** + * Account id. + */ + @visibility(Lifecycle.Read) + accountId?: string; + + /** + * Link for copy error logs. + */ + @visibility(Lifecycle.Read) + errorLogLink?: string; + + /** + * Link for copy verbose logs. + */ + @visibility(Lifecycle.Read) + verboseLogLink?: string; + + /** + * Indicates the type of job details. + */ + copyLogDetailsType: ClassDiscriminator.DataBoxCustomerDisk; +} + +/** + * Granular Details for log generated during copy. + */ +@discriminator("copyLogDetailsType") +model GranularCopyLogDetails { + /** + * Indicates the type of job details. + */ + #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + copyLogDetailsType: ClassDiscriminator; +} + +/** + * DataBox Disk Granular Copy Progress + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model DataBoxDiskGranularCopyProgress extends GranularCopyProgress { + /** + * Disk Serial Number. + */ + @visibility(Lifecycle.Read) + serialNumber?: string; + + /** + * The Status of the copy + */ + @visibility(Lifecycle.Read) + copyStatus?: CopyStatus; +} + +/** + * Granular Copy progress. + */ +model GranularCopyProgress { + /** + * Name of the storage account. This will be empty for data account types other than storage account. + */ + @visibility(Lifecycle.Read) + storageAccountName?: string; + + /** + * Transfer type of data + */ + @visibility(Lifecycle.Read) + transferType?: TransferType; + + /** + * Data Account Type. + */ + @visibility(Lifecycle.Read) + dataAccountType?: DataAccountType; + + /** + * Id of the account where the data needs to be uploaded. + */ + @visibility(Lifecycle.Read) + accountId?: string; + + /** + * To indicate bytes transferred. + */ + @visibility(Lifecycle.Read) + bytesProcessed?: int64; + + /** + * Total amount of data to be processed by the job. + */ + @visibility(Lifecycle.Read) + totalBytesToProcess?: int64; + + /** + * Number of files processed + */ + @visibility(Lifecycle.Read) + filesProcessed?: int64; + + /** + * Total files to process + */ + @visibility(Lifecycle.Read) + totalFilesToProcess?: int64; + + /** + * Number of files not adhering to azure naming conventions which were processed by automatic renaming + */ + @visibility(Lifecycle.Read) + invalidFilesProcessed?: int64; + + /** + * Total amount of data not adhering to azure naming conventions which were processed by automatic renaming + */ + @visibility(Lifecycle.Read) + invalidFileBytesUploaded?: int64; + + /** + * Number of folders not adhering to azure naming conventions which were processed by automatic renaming + */ + @visibility(Lifecycle.Read) + renamedContainerCount?: int64; + + /** + * Number of files which could not be copied + */ + @visibility(Lifecycle.Read) + filesErroredOut?: int64; + + /** + * To indicate directories errored out in the job. + */ + @visibility(Lifecycle.Read) + directoriesErroredOut?: int64; + + /** + * To indicate directories renamed + */ + @visibility(Lifecycle.Read) + invalidDirectoriesProcessed?: int64; + + /** + * To indicate if enumeration of data is in progress. + * Until this is true, the TotalBytesToProcess may not be valid. + */ + @visibility(Lifecycle.Read) + isEnumerationInProgress?: boolean; + + /** + * Error, if any, in the stage + */ + @visibility(Lifecycle.Read) + error?: CloudError; + + /** + * Available actions on the job. + */ + @visibility(Lifecycle.Read) + actions?: CustomerResolutionCode[]; +} + +/** + * DataBox Disk Job Details. + */ +model DataBoxDiskJobDetails extends JobDetails { + /** + * User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + preferredDisks?: Record; + + /** + * Copy progress per disk. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + copyProgress?: DataBoxDiskCopyProgress[]; + + /** + * Copy progress per disk. + */ + @visibility(Lifecycle.Read) + @identifiers(#[]) + granularCopyProgress?: DataBoxDiskGranularCopyProgress[]; + + /** + * Copy progress per disk. + */ + @visibility(Lifecycle.Read) + @identifiers(#[]) + granularCopyLogDetails?: DataBoxDiskGranularCopyLogDetails[]; + + /** + * Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + disksAndSizeDetails?: Record; + + /** + * User entered passkey for DataBox Disk job. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + passkey?: string; + + /** + * Indicates the type of job details. + */ + jobDetailsType: ClassDiscriminator.DataBoxDisk; +} + +/** + * The secrets related to disk job. + */ +model DataBoxDiskJobSecrets extends JobSecrets { + /** + * Contains the list of secrets object for that device. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + diskSecrets?: DiskSecret[]; + + /** + * PassKey for the disk Job. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @visibility(Lifecycle.Read) + passKey?: string; + + /** + * Whether passkey was provided by user. + */ + @visibility(Lifecycle.Read) + isPasskeyUserDefined?: boolean; + + /** + * Used to indicate what type of job secrets object. + */ + jobSecretsType: ClassDiscriminator.DataBoxDisk; +} + +/** + * Copy log details for a storage account for Databox heavy + */ +model DataBoxHeavyAccountCopyLogDetails extends CopyLogDetails { + /** + * Account name. + */ + @visibility(Lifecycle.Read) + accountName?: string; + + /** + * Link for copy logs. + */ + @visibility(Lifecycle.Read) + copyLogLink?: string[]; + + /** + * Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose. + */ + @visibility(Lifecycle.Read) + copyVerboseLogLink?: string[]; + + /** + * Indicates the type of job details. + */ + copyLogDetailsType: ClassDiscriminator.DataBoxHeavy; +} + +/** + * Databox Heavy Device Job Details + */ +model DataBoxHeavyJobDetails extends JobDetails { + /** + * Copy progress per account. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + copyProgress?: CopyProgress[]; + + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @doc("Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+") + devicePassword?: string; + + /** + * Indicates the type of job details. + */ + jobDetailsType: ClassDiscriminator.DataBoxHeavy; +} + +/** + * The secrets related to a databox heavy job. + */ +model DataBoxHeavyJobSecrets extends JobSecrets { + /** + * Contains the list of secret objects for a databox heavy job. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + cabinetPodSecrets?: DataBoxHeavySecret[]; + + /** + * Used to indicate what type of job secrets object. + */ + jobSecretsType: ClassDiscriminator.DataBoxHeavy; +} + +/** + * The secrets related to a databox heavy. + */ +model DataBoxHeavySecret { + /** + * Serial number of the assigned device. + */ + @visibility(Lifecycle.Read) + deviceSerialNumber?: string; + + /** + * Password for out of the box experience on device. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @visibility(Lifecycle.Read) + devicePassword?: string; + + /** + * Network configuration of the appliance. + */ + @visibility(Lifecycle.Read) + networkConfigurations?: ApplianceNetworkConfiguration[]; + + /** + * The base 64 encoded public key to authenticate with the device + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @visibility(Lifecycle.Read) + encodedValidationCertPubKey?: string; + + /** + * Per account level access credentials. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + accountCredentialDetails?: AccountCredentialDetails[]; +} + +/** + * Databox Job Details + */ +model DataBoxJobDetails extends JobDetails { + /** + * Copy progress per storage account. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + copyProgress?: CopyProgress[]; + + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @doc("Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+") + devicePassword?: string; + + /** + * Indicates the type of job details. + */ + jobDetailsType: ClassDiscriminator.DataBox; +} + +/** + * Request body to get the availability for scheduling data box orders orders. + */ +model DataBoxScheduleAvailabilityRequest extends ScheduleAvailabilityRequest { + /** + * Sku Name for which the order is to be scheduled. + */ + skuName: SkuName.DataBox; +} + +/** + * The secrets related to a DataBox. + */ +model DataBoxSecret { + /** + * Serial number of the assigned device. + */ + @visibility(Lifecycle.Read) + deviceSerialNumber?: string; + + /** + * Password for out of the box experience on device. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @visibility(Lifecycle.Read) + devicePassword?: string; + + /** + * Network configuration of the appliance. + */ + @visibility(Lifecycle.Read) + networkConfigurations?: ApplianceNetworkConfiguration[]; + + /** + * The base 64 encoded public key to authenticate with the device + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + @visibility(Lifecycle.Read) + encodedValidationCertPubKey?: string; + + /** + * Per account level access credentials. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + accountCredentialDetails?: AccountCredentialDetails[]; +} + +/** + * Request to validate export and import data details. + */ +model DataTransferDetailsValidationRequest extends ValidationInputRequest { + /** + * List of DataTransfer details to be used to export data from azure. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + dataExportDetails?: DataExportDetails[]; + + /** + * List of DataTransfer details to be used to import data to azure. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + dataImportDetails?: DataImportDetails[]; + + /** + * Device type. + */ + deviceType: SkuName; + + /** + * Type of the transfer. + */ + transferType: TransferType; + + /** + * The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + */ + `model`?: ModelName; + + /** + * Identifies the type of validation request. + */ + validationType: ValidationInputDiscriminator.ValidateDataTransferDetails; +} + +/** + * Properties of data transfer details validation response. + */ +model DataTransferDetailsValidationResponseProperties + extends ValidationInputResponse { + /** + * Data transfer details validation status. + */ + @visibility(Lifecycle.Read) + status?: ValidationStatus; + + /** + * Identifies the type of validation response. + */ + validationType: ValidationInputDiscriminator.ValidateDataTransferDetails; +} + +/** + * The secrets related to a databox job. + */ +model DataboxJobSecrets extends JobSecrets { + /** + * Contains the list of secret objects for a job. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + podSecrets?: DataBoxSecret[]; + + /** + * Used to indicate what type of job secrets object. + */ + jobSecretsType: ClassDiscriminator.DataBox; +} + +/** + * Datacenter instruction for given storage location. + */ +model DatacenterAddressInstructionResponse extends DatacenterAddressResponse { + /** + * Data center communication instruction + */ + @visibility(Lifecycle.Read) + communicationInstruction?: string; + + /** + * Data center address type + */ + datacenterAddressType: DatacenterAddressType.DatacenterAddressInstruction; +} + +/** + * Datacenter address for given storage location. + */ +model DatacenterAddressLocationResponse extends DatacenterAddressResponse { + /** + * Contact person name + */ + @visibility(Lifecycle.Read) + contactPersonName?: string; + + /** + * Company name + */ + @visibility(Lifecycle.Read) + company?: string; + + /** + * Street address line 1 + */ + @visibility(Lifecycle.Read) + street1?: string; + + /** + * Street address line 2 + */ + @visibility(Lifecycle.Read) + street2?: string; + + /** + * Street address line 3 + */ + @visibility(Lifecycle.Read) + street3?: string; + + /** + * City name + */ + @visibility(Lifecycle.Read) + city?: string; + + /** + * name of the state + */ + @visibility(Lifecycle.Read) + state?: string; + + /** + * Zip code + */ + @visibility(Lifecycle.Read) + zip?: string; + + /** + * name of the country + */ + @visibility(Lifecycle.Read) + country?: string; + + /** + * Phone number + */ + @visibility(Lifecycle.Read) + phone?: string; + + /** + * Phone extension + */ + @visibility(Lifecycle.Read) + phoneExtension?: string; + + /** + * Address type + */ + @visibility(Lifecycle.Read) + addressType?: string; + + /** + * Special instruction for shipping + */ + @visibility(Lifecycle.Read) + additionalShippingInformation?: string; + + /** + * Data center address type + */ + datacenterAddressType: DatacenterAddressType.DatacenterAddressLocation; +} + +/** + * Request body to get the availability for scheduling disk orders. + */ +model DiskScheduleAvailabilityRequest extends ScheduleAvailabilityRequest { + /** + * The expected size of the data, which needs to be transferred in this job, in terabytes. + */ + expectedDataSizeInTeraBytes: int32; + + /** + * Sku Name for which the order is to be scheduled. + */ + skuName: SkuName.DataBoxDisk; +} + +/** + * Request body to get the availability for scheduling heavy orders. + */ +model HeavyScheduleAvailabilityRequest extends ScheduleAvailabilityRequest { + /** + * Sku Name for which the order is to be scheduled. + */ + skuName: SkuName.DataBoxHeavy; +} + +/** + * Details of the managed disks. + */ +model ManagedDiskDetails extends DataAccountDetails { + /** + * Resource Group Id of the compute disks. + */ + resourceGroupId: string; + + /** + * Resource Id of the storage account that can be used to copy the vhd for staging. + */ + stagingStorageAccountId: string; + + /** + * Account Type of the data to be transferred. + */ + dataAccountType: DataAccountType.ManagedDisk; +} + +/** + * Request to validate preference of transport and data center. + */ +model PreferencesValidationRequest extends ValidationInputRequest { + /** + * Preference of transport and data center. + */ + preference?: Preferences; + + /** + * Device type to be used for the job. + */ + deviceType: SkuName; + + /** + * The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + */ + `model`?: ModelName; + + /** + * Identifies the type of validation request. + */ + validationType: ValidationInputDiscriminator.ValidatePreferences; +} + +/** + * Properties of data center and transport preference validation response. + */ +model PreferencesValidationResponseProperties extends ValidationInputResponse { + /** + * Validation status of requested data center and transport. + */ + @visibility(Lifecycle.Read) + status?: ValidationStatus; + + /** + * Identifies the type of validation response. + */ + validationType: ValidationInputDiscriminator.ValidatePreferences; +} + +/** + * Request to validate sku availability. + */ +model SkuAvailabilityValidationRequest extends ValidationInputRequest { + /** + * Device type to be used for the job. + */ + deviceType: SkuName; + + /** + * Type of the transfer. + */ + transferType: TransferType; + + /** + * ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + */ + country: string; + + /** + * Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + */ + location: string; + + /** + * The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + */ + `model`?: ModelName; + + /** + * Identifies the type of validation request. + */ + validationType: ValidationInputDiscriminator.ValidateSkuAvailability; +} + +/** + * Properties of sku availability validation response. + */ +model SkuAvailabilityValidationResponseProperties + extends ValidationInputResponse { + /** + * Sku availability validation status. + */ + @visibility(Lifecycle.Read) + status?: ValidationStatus; + + /** + * Identifies the type of validation response. + */ + validationType: ValidationInputDiscriminator.ValidateSkuAvailability; +} + +/** + * Details for the storage account. + */ +model StorageAccountDetails extends DataAccountDetails { + /** + * Storage Account Resource Id. + */ + storageAccountId: string; + + /** + * Account Type of the data to be transferred. + */ + dataAccountType: DataAccountType.StorageAccount; +} + +/** + * Request to validate subscription permission to create jobs. + */ +model SubscriptionIsAllowedToCreateJobValidationRequest + extends ValidationInputRequest { + /** + * Identifies the type of validation request. + */ + validationType: ValidationInputDiscriminator.ValidateSubscriptionIsAllowedToCreateJob; +} + +/** + * Properties of subscription permission to create job validation response. + */ +model SubscriptionIsAllowedToCreateJobValidationResponseProperties + extends ValidationInputResponse { + /** + * Validation status of subscription permission to create job. + */ + @visibility(Lifecycle.Read) + status?: ValidationStatus; + + /** + * Identifies the type of validation response. + */ + validationType: ValidationInputDiscriminator.ValidateSubscriptionIsAllowedToCreateJob; +} +/** + * Operation properties. + */ +#suppress "@azure-tools/typespec-azure-resource-manager/no-empty-model" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model OperationProperties {} + +/** + * Operation display + */ +model OperationDisplay { + /** + * Provider name. + */ + provider?: string; + + /** + * Resource name. + */ + resource?: string; + + /** + * Localized name of the operation for display purpose. + */ + operation?: string; + + /** + * Localized description of the operation for display purpose. + */ + description?: string; +} + +/** + * Operation entity. + */ +model Operation { + /** + Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action} + */ + @visibility(Lifecycle.Read) + name?: string; + + /** + * Operation display values. + */ + @visibility(Lifecycle.Read) + display?: OperationDisplay; + + /** + * Operation properties. + */ + @visibility(Lifecycle.Read) + properties?: OperationProperties; + + /** + * Origin of the operation. Can be : user|system|user,system + */ + @visibility(Lifecycle.Read) + origin?: string; + + /** + * Indicates whether the operation is a data action + */ + isDataAction?: boolean; +} + +/** + * The paginated list of connected cluster API operations. + */ +model OperationList { + /** + * The list of connected cluster API operations. + */ + @pageItems + @visibility(Lifecycle.Read) + value?: Operation[]; + + /** + * The link to fetch the next page of connected cluster API operations. + */ + @nextLink + nextLink?: string; +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/preview/2021-08-01-preview/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/preview/2021-08-01-preview/databox.json new file mode 100644 index 00000000000..6911677f034 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/preview/2021-08-01-preview/databox.json @@ -0,0 +1,6013 @@ +{ + "swagger": "2.0", + "info": { + "version": "2021-08-01-preview", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mark devices for a given job as shipped", + "operationId": "Jobs_MarkDevicesShipped", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "markDevicesShippedRequest", + "in": "body", + "description": "Mark Devices Shipped Request", + "required": true, + "schema": { + "$ref": "#/definitions/MarkDevicesShippedRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "MarkDevicesShipped": { + "$ref": "./examples/MarkDevicesShipped.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + }, + "JobsGetWaitingForAction": { + "$ref": "./examples/JobsGetWaitingForAction.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job." + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "type": "object", + "description": "Additional error info.", + "properties": { + "type": { + "description": "Additional error type.", + "type": "string" + }, + "info": { + "description": "Additional error info.", + "type": "object" + } + } + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Cloud error.", + "type": "object", + "properties": { + "code": { + "description": "Cloud error code.", + "type": "string" + }, + "message": { + "description": "Cloud error message.", + "type": "string" + }, + "target": { + "description": "Cloud error target.", + "type": "string" + }, + "details": { + "description": "Cloud error details.", + "type": "array", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true + }, + "additionalInfo": { + "description": "Cloud error additional info.", + "type": "array", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true + } + }, + "x-ms-external": true + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "DataBoxCustomerDiskCopyProgress": { + "description": "DataBox CustomerDisk Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataBoxCustomerDiskJobDetails": { + "description": "Customer disk job details.", + "required": [ + "jobDetailsType", + "returnToCustomerPackageDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "importDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for import jobs.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ImportDiskDetails" + } + }, + "exportDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for export jobs.", + "type": "object", + "readOnly": true, + "additionalProperties": { + "$ref": "#/definitions/ExportDiskDetails" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxCustomerDiskCopyProgress" + }, + "readOnly": true + }, + "deliverToDcPackageDetails": { + "description": "Delivery package shipping details.", + "$ref": "#/definitions/PackageCarrierInfo", + "readOnly": true + }, + "returnToCustomerPackageDetails": { + "description": "Return package shipping details.", + "$ref": "#/definitions/PackageCarrierDetails" + }, + "enableManifestBackup": { + "description": "Flag to indicate if disk manifest should be backed-up in the Storage Account.", + "type": "boolean", + "default": false + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "CustomerDiskJobSecrets": { + "description": "The secrets related to customer disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "carrierAccountNumber": { + "description": "Carrier Account Number of the customer", + "type": "string", + "readOnly": true, + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DatacenterAddressInstructionResponse": { + "description": "Datacenter instruction for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "communicationInstruction": { + "description": "Data center communication instruction", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressInstruction" + }, + "DatacenterAddressLocationResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "contactPersonName": { + "description": "Contact person name", + "type": "string", + "readOnly": true + }, + "company": { + "description": "Company name", + "type": "string", + "readOnly": true + }, + "street1": { + "description": "Street address line 1", + "type": "string", + "readOnly": true + }, + "street2": { + "description": "Street address line 2", + "type": "string", + "readOnly": true + }, + "street3": { + "description": "Street address line 3", + "type": "string", + "readOnly": true + }, + "city": { + "description": "City name", + "type": "string", + "readOnly": true + }, + "state": { + "description": "name of the state", + "type": "string", + "readOnly": true + }, + "zip": { + "description": "Zip code", + "type": "string", + "readOnly": true + }, + "country": { + "description": "name of the country", + "type": "string", + "readOnly": true + }, + "phone": { + "description": "Phone number", + "type": "string", + "readOnly": true + }, + "phoneExtension": { + "description": "Phone extension", + "type": "string", + "readOnly": true + }, + "addressType": { + "description": "Address type", + "type": "string", + "readOnly": true + }, + "additionalShippingInformation": { + "description": "Special instruction for shipping", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressLocation" + }, + "DatacenterAddressRequest": { + "description": "Request body to get the datacenter address.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the data center address requested.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "DatacenterAddressResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "properties": { + "datacenterAddressType": { + "description": "Data center address type", + "enum": [ + "DatacenterAddressLocation", + "DatacenterAddressInstruction" + ], + "type": "string", + "x-ms-enum": { + "name": "DatacenterAddressType", + "modelAsExtensible": false, + "values": [ + { + "value": "DatacenterAddressLocation", + "description": "Data center address location." + }, + { + "value": "DatacenterAddressInstruction", + "description": "Data center address instruction." + } + ] + } + }, + "supportedCarriersForReturnShipment": { + "description": "List of supported carriers for return shipment.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "dataCenterAzureLocation": { + "description": "Azure Location where the Data Center serves primarily.", + "type": "string", + "readOnly": true + } + }, + "discriminator": "datacenterAddressType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxCustomerDiskCopyLogDetails": { + "description": "Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "ExportDiskDetails": { + "description": "Export disk details", + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "ImportDiskDetails": { + "description": "Import disk details", + "required": [ + "manifestFile", + "manifestHash", + "bitLockerKey" + ], + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string" + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string" + }, + "bitLockerKey": { + "description": "BitLocker key used to encrypt the disk.", + "type": "string", + "x-ms-secret": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + }, + "datacenterAddress": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address to ship to, for the given sku and storage location.", + "readOnly": true + }, + "dataCenterCode": { + "description": "DataCenter code.", + "enum": [ + "Invalid", + "BY2", + "BY1", + "ORK70", + "AM2", + "AMS20", + "BY21", + "BY24", + "MWH01", + "AMS06", + "SSE90", + "SYD03", + "SYD23", + "CBR20", + "YTO20", + "CWL20", + "LON24", + "BOM01", + "BL20", + "BL7", + "SEL20", + "TYO01", + "BN1", + "SN5", + "CYS04", + "TYO22", + "YTO21", + "YQB20", + "FRA22", + "MAA01", + "CPQ02", + "CPQ20", + "SIN20", + "HKG20", + "SG2", + "MEL23", + "SEL21", + "OSA20", + "SHA03", + "BJB", + "JNB22", + "JNB21", + "MNZ21", + "SN8", + "AUH20", + "ZRH20", + "PUS20", + "AdHoc", + "CH1", + "DSM05", + "BN7", + "SN6", + "PAR22" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataCenterCode", + "modelAsString": true, + "values": [ + { + "value": "Invalid" + }, + { + "value": "BY2" + }, + { + "value": "BY1" + }, + { + "value": "ORK70" + }, + { + "value": "AM2" + }, + { + "value": "AMS20" + }, + { + "value": "BY21" + }, + { + "value": "BY24" + }, + { + "value": "MWH01" + }, + { + "value": "AMS06" + }, + { + "value": "SSE90" + }, + { + "value": "SYD03" + }, + { + "value": "SYD23" + }, + { + "value": "CBR20" + }, + { + "value": "YTO20" + }, + { + "value": "CWL20" + }, + { + "value": "LON24" + }, + { + "value": "BOM01" + }, + { + "value": "BL20" + }, + { + "value": "BL7" + }, + { + "value": "SEL20" + }, + { + "value": "TYO01" + }, + { + "value": "BN1" + }, + { + "value": "SN5" + }, + { + "value": "CYS04" + }, + { + "value": "TYO22" + }, + { + "value": "YTO21" + }, + { + "value": "YQB20" + }, + { + "value": "FRA22" + }, + { + "value": "MAA01" + }, + { + "value": "CPQ02" + }, + { + "value": "CPQ20" + }, + { + "value": "SIN20" + }, + { + "value": "HKG20" + }, + { + "value": "SG2" + }, + { + "value": "MEL23" + }, + { + "value": "SEL21" + }, + { + "value": "OSA20" + }, + { + "value": "SHA03" + }, + { + "value": "BJB" + }, + { + "value": "JNB22" + }, + { + "value": "JNB21" + }, + { + "value": "MNZ21" + }, + { + "value": "SN8" + }, + { + "value": "AUH20" + }, + { + "value": "ZRH20" + }, + { + "value": "PUS20" + }, + { + "value": "AdHoc" + }, + { + "value": "CH1" + }, + { + "value": "DSM05" + }, + { + "value": "BN7" + }, + { + "value": "SN6" + }, + { + "value": "PAR22" + } + ] + } + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "MarkDevicesShippedRequest": { + "description": "The request body to provide the delivery package details of job", + "required": [ + "deliverToDcPackageDetails" + ], + "type": "object", + "properties": { + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package details" + } + } + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "required": [ + "customerResolutionCode" + ], + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + } + ] + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Created", + "ShippedToCustomer" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsString": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + }, + { + "value": "Created", + "description": "Notification at job created stage." + }, + { + "value": "ShippedToCustomer", + "description": "Notification at shipped devices to customer stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageCarrierDetails": { + "description": "Package carrier details.", + "type": "object", + "properties": { + "carrierAccountNumber": { + "description": "Carrier Account Number of customer for customer disk.", + "type": "string", + "x-ms-secret": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageCarrierInfo": { + "description": "package carrier info", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageShippingDetails": { + "description": "package shipping details", + "type": "object", + "properties": { + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + }, + "datacenterAddressRequest": { + "$ref": "#/definitions/DatacenterAddressRequest", + "description": "Request body to get the datacenter address for given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + }, + "datacenterAddressResponse": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address for given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package details of job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/preview/2024-02-01-preview/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/preview/2024-02-01-preview/databox.json new file mode 100644 index 00000000000..f4d4c2b5ed9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/preview/2024-02-01-preview/databox.json @@ -0,0 +1,7215 @@ +{ + "swagger": "2.0", + "info": { + "version": "2024-02-01-preview", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mark devices for a given job as shipped", + "operationId": "Jobs_MarkDevicesShipped", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "markDevicesShippedRequest", + "in": "body", + "description": "Mark Devices Shipped Request", + "required": true, + "schema": { + "$ref": "#/definitions/MarkDevicesShippedRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "MarkDevicesShipped": { + "$ref": "./examples/MarkDevicesShipped.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + }, + "JobsGetWaitingForAction": { + "$ref": "./examples/JobsGetWaitingForAction.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "description": "This class represents additional info which Resource Providers pass when an error occurs.", + "properties": { + "info": { + "description": "Additional information of the type of error.", + "type": "object" + }, + "type": { + "description": "Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation).", + "type": "string" + } + }, + "type": "object" + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Provides additional information about an http error response.", + "properties": { + "additionalInfo": { + "description": "Gets or sets additional error info.", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true, + "type": "array" + }, + "code": { + "description": "Error code.", + "type": "string" + }, + "details": { + "description": "Gets or sets details for the error.", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true, + "type": "array" + }, + "message": { + "description": "The error message parsed from the body of the http error response.", + "type": "string" + }, + "target": { + "description": "Gets or sets the target of the error.", + "type": "string" + } + }, + "type": "object" + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "ContactInfo": { + "description": "Contact Info.", + "required": [ + "contactName", + "phone" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "minLength": 1, + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "minLength": 1, + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "GranularCopyLogDetails": { + "description": "Granular Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "DataBoxCustomerDiskCopyProgress": { + "description": "DataBox CustomerDisk Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DeviceErasureDetails": { + "description": "Device erasure details with erasure completion status and erasureordestructionlog sas key", + "type": "object", + "properties": { + "deviceErasureStatus": { + "description": "Holds the device erasure completion status", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action for clean up." + } + ] + } + }, + "erasureOrDestructionCertificateSasKey": { + "description": "Shared access key to download cleanup or destruction certificate for device", + "type": "string", + "readOnly": true + } + } + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "GranularCopyProgress": { + "description": "Granular Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataBoxCustomerDiskJobDetails": { + "description": "Customer disk job details.", + "required": [ + "jobDetailsType", + "returnToCustomerPackageDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "importDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for import jobs.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ImportDiskDetails" + } + }, + "exportDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for export jobs.", + "type": "object", + "readOnly": true, + "additionalProperties": { + "$ref": "#/definitions/ExportDiskDetails" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxCustomerDiskCopyProgress" + }, + "readOnly": true + }, + "deliverToDcPackageDetails": { + "description": "Delivery package shipping details.", + "$ref": "#/definitions/PackageCarrierInfo", + "readOnly": true + }, + "returnToCustomerPackageDetails": { + "description": "Return package shipping details.", + "$ref": "#/definitions/PackageCarrierDetails" + }, + "enableManifestBackup": { + "description": "Flag to indicate if disk manifest should be backed-up in the Storage Account.", + "type": "boolean", + "default": false + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "CustomerDiskJobSecrets": { + "description": "The secrets related to customer disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "carrierAccountNumber": { + "description": "Carrier Account Number of the customer", + "type": "string", + "readOnly": true, + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DatacenterAddressInstructionResponse": { + "description": "Datacenter instruction for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "communicationInstruction": { + "description": "Data center communication instruction", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressInstruction" + }, + "DatacenterAddressLocationResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "contactPersonName": { + "description": "Contact person name", + "type": "string", + "readOnly": true + }, + "company": { + "description": "Company name", + "type": "string", + "readOnly": true + }, + "street1": { + "description": "Street address line 1", + "type": "string", + "readOnly": true + }, + "street2": { + "description": "Street address line 2", + "type": "string", + "readOnly": true + }, + "street3": { + "description": "Street address line 3", + "type": "string", + "readOnly": true + }, + "city": { + "description": "City name", + "type": "string", + "readOnly": true + }, + "state": { + "description": "name of the state", + "type": "string", + "readOnly": true + }, + "zip": { + "description": "Zip code", + "type": "string", + "readOnly": true + }, + "country": { + "description": "name of the country", + "type": "string", + "readOnly": true + }, + "phone": { + "description": "Phone number", + "type": "string", + "readOnly": true + }, + "phoneExtension": { + "description": "Phone extension", + "type": "string", + "readOnly": true + }, + "addressType": { + "description": "Address type", + "type": "string", + "readOnly": true + }, + "additionalShippingInformation": { + "description": "Special instruction for shipping", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressLocation" + }, + "DatacenterAddressRequest": { + "description": "Request body to get the datacenter address.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the data center address requested.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "DatacenterAddressResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "properties": { + "datacenterAddressType": { + "description": "Data center address type", + "enum": [ + "DatacenterAddressLocation", + "DatacenterAddressInstruction" + ], + "type": "string", + "x-ms-enum": { + "name": "DatacenterAddressType", + "modelAsExtensible": false, + "values": [ + { + "value": "DatacenterAddressLocation", + "description": "Data center address location." + }, + { + "value": "DatacenterAddressInstruction", + "description": "Data center address instruction." + } + ] + } + }, + "supportedCarriersForReturnShipment": { + "description": "List of supported carriers for return shipment.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "dataCenterAzureLocation": { + "description": "Azure Location where the Data Center serves primarily.", + "type": "string", + "readOnly": true + } + }, + "discriminator": "datacenterAddressType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxCustomerDiskCopyLogDetails": { + "description": "Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskGranularCopyLogDetails": { + "description": "Granular Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "accountId": { + "description": "Account id.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "DataBoxDiskGranularCopyProgress": { + "description": "DataBox Disk Granular Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "granularCopyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyProgress" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "granularCopyLogDetails": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyLogDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DeviceCapabilityDetails": { + "description": "Device capability details for a given sku for a given region.", + "type": "object", + "properties": { + "hardwareEncryption": { + "description": "Hardware encryption support for a given sku for a given region.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "HardwareEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Hardware-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Hardware-based encryption is disabled." + } + ] + } + } + } + }, + "DeviceCapabilityRequest": { + "description": "Request body to get the device capabilities for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "DeviceCapabilityResponse": { + "description": "Device capabilities for given sku in a region", + "type": "object", + "properties": { + "deviceCapabilityDetails": { + "description": "List of device capabilities available for a given region and a given sku", + "type": "array", + "items": { + "$ref": "#/definitions/DeviceCapabilityDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + }, + "hardwareEncryption": { + "description": "Defines Hardware level encryption (Only for disk)", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "HardwareEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Hardware-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Hardware-based encryption is enabled." + } + ] + } + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "ExportDiskDetails": { + "description": "Export disk details", + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "ImportDiskDetails": { + "description": "Import disk details", + "required": [ + "manifestFile", + "manifestHash", + "bitLockerKey" + ], + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string" + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string" + }, + "bitLockerKey": { + "description": "BitLocker key used to encrypt the disk.", + "type": "string", + "x-ms-secret": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDelayDetails": { + "description": "Job Delay Notification details", + "type": "object", + "properties": { + "status": { + "description": "Status of notification", + "enum": [ + "Active", + "Resolved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DelayNotificationStatus", + "modelAsString": true, + "values": [ + { + "value": "Active", + "description": "Delay is still active" + }, + { + "value": "Resolved", + "description": "Delay has been resolved" + } + ] + } + }, + "errorCode": { + "description": "Delay Error code", + "enum": [ + "InternalIssueDelay", + "ActiveOrderLimitBreachedDelay", + "HighDemandDelay", + "LargeNumberOfFilesDelay" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "PortalDelayErrorCode", + "modelAsString": true, + "values": [ + { + "value": "InternalIssueDelay", + "description": "Delay due to any internal reasons" + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "Active Order limit breached." + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "High demand" + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "Slow copy due to large number of files" + } + ] + } + }, + "description": { + "description": "Description of the delay.", + "type": "string", + "readOnly": true + }, + "startTime": { + "format": "date-time", + "description": "Timestamp when the delay notification was created.", + "type": "string", + "readOnly": true + }, + "resolutionTime": { + "format": "date-time", + "description": "Timestamp when the delay notification was resolved.", + "type": "string", + "readOnly": true + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails", + "description": "Optional Reverse Shipping details for order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "deviceErasureDetails": { + "$ref": "#/definitions/DeviceErasureDetails", + "description": "Holds device data erasure details", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + }, + "datacenterAddress": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address to ship to, for the given sku and storage location.", + "readOnly": true + }, + "dataCenterCode": { + "description": "DataCenter code.", + "enum": [ + "Invalid", + "BY2", + "BY1", + "ORK70", + "AM2", + "AMS20", + "BY21", + "BY24", + "MWH01", + "AMS06", + "SSE90", + "SYD03", + "SYD23", + "CBR20", + "YTO20", + "CWL20", + "LON24", + "BOM01", + "BL20", + "BL7", + "SEL20", + "TYO01", + "BN1", + "SN5", + "CYS04", + "TYO22", + "YTO21", + "YQB20", + "FRA22", + "MAA01", + "CPQ02", + "CPQ20", + "SIN20", + "HKG20", + "SG2", + "MEL23", + "SEL21", + "OSA20", + "SHA03", + "BJB", + "JNB22", + "JNB21", + "MNZ21", + "SN8", + "AUH20", + "ZRH20", + "PUS20", + "AdHoc", + "CH1", + "DSM05", + "DUB07", + "PNQ01", + "SVG20", + "OSA02", + "OSA22", + "PAR22", + "BN7", + "SN6", + "BJS20", + "BL24", + "IDC5", + "TYO23", + "NTG20", + "DXB23", + "DSM11", + "AMS25", + "CPQ21", + "OSA23" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataCenterCode", + "modelAsString": true, + "values": [ + { + "value": "Invalid" + }, + { + "value": "BY2" + }, + { + "value": "BY1" + }, + { + "value": "ORK70" + }, + { + "value": "AM2" + }, + { + "value": "AMS20" + }, + { + "value": "BY21" + }, + { + "value": "BY24" + }, + { + "value": "MWH01" + }, + { + "value": "AMS06" + }, + { + "value": "SSE90" + }, + { + "value": "SYD03" + }, + { + "value": "SYD23" + }, + { + "value": "CBR20" + }, + { + "value": "YTO20" + }, + { + "value": "CWL20" + }, + { + "value": "LON24" + }, + { + "value": "BOM01" + }, + { + "value": "BL20" + }, + { + "value": "BL7" + }, + { + "value": "SEL20" + }, + { + "value": "TYO01" + }, + { + "value": "BN1" + }, + { + "value": "SN5" + }, + { + "value": "CYS04" + }, + { + "value": "TYO22" + }, + { + "value": "YTO21" + }, + { + "value": "YQB20" + }, + { + "value": "FRA22" + }, + { + "value": "MAA01" + }, + { + "value": "CPQ02" + }, + { + "value": "CPQ20" + }, + { + "value": "SIN20" + }, + { + "value": "HKG20" + }, + { + "value": "SG2" + }, + { + "value": "MEL23" + }, + { + "value": "SEL21" + }, + { + "value": "OSA20" + }, + { + "value": "SHA03" + }, + { + "value": "BJB" + }, + { + "value": "JNB22" + }, + { + "value": "JNB21" + }, + { + "value": "MNZ21" + }, + { + "value": "SN8" + }, + { + "value": "AUH20" + }, + { + "value": "ZRH20" + }, + { + "value": "PUS20" + }, + { + "value": "AdHoc" + }, + { + "value": "CH1" + }, + { + "value": "DSM05" + }, + { + "value": "DUB07" + }, + { + "value": "PNQ01" + }, + { + "value": "SVG20" + }, + { + "value": "OSA02" + }, + { + "value": "OSA22" + }, + { + "value": "PAR22" + }, + { + "value": "BN7" + }, + { + "value": "SN6" + }, + { + "value": "BJS20" + }, + { + "value": "BL24" + }, + { + "value": "IDC5" + }, + { + "value": "TYO23" + }, + { + "value": "CPQ21" + }, + { + "value": "NTG20" + }, + { + "value": "DXB23" + }, + { + "value": "DSM11" + }, + { + "value": "OSA23" + }, + { + "value": "AMS25" + } + ] + } + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "reverseShippingDetailsUpdate": { + "description": "The Editable status for Reverse Shipping Address and Contact Info", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseShippingDetailsEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse shipping details can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse shipping details." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse shipping details. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "reverseTransportPreferenceUpdate": { + "description": "The Editable status for Reverse Transport preferences", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseTransportPreferenceEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse Transport Preferences can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse Transport Preferences." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse Transport Preferences. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "delayedStage": { + "description": "Name of the stage where delay might be present.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + }, + "allDevicesLost": { + "description": "Flag to indicate if all devices associated with the job are lost.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + }, + "delayInformation": { + "description": "Delay information for the job stages.", + "type": "array", + "items": { + "$ref": "#/definitions/JobDelayDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "MarkDevicesShippedRequest": { + "description": "The request body to provide the delivery package details of job", + "required": [ + "deliverToDcPackageDetails" + ], + "type": "object", + "properties": { + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package details" + } + } + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "serialNumberCustomerResolutionMap": { + "description": "Serial number and the customer resolution code corresponding to each serial number", + "type": "object", + "additionalProperties": { + "format": "int32", + "description": "Available customer resolution codes on a job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job" + }, + { + "value": "Restart", + "description": "Restart whole action" + }, + { + "value": "ReachOutToOperation", + "description": "Reach out to operation for further action" + } + ] + } + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Created", + "ShippedToCustomer" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsString": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + }, + { + "value": "Created", + "description": "Notification at job created stage." + }, + { + "value": "ShippedToCustomer", + "description": "Notification at shipped devices to customer stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageCarrierDetails": { + "description": "Package carrier details.", + "type": "object", + "properties": { + "carrierAccountNumber": { + "description": "Carrier Account Number of customer for customer disk.", + "type": "string", + "x-ms-secret": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageCarrierInfo": { + "description": "package carrier info", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageShippingDetails": { + "description": "package shipping details", + "type": "object", + "properties": { + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "reverseTransportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Optional Preferences related to the reverse shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + }, + "storageAccountAccessTierPreferences": { + "description": "Preferences related to the Access Tier of storage accounts.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "Archive" + ], + "type": "string", + "x-ms-enum": { + "name": "StorageAccountAccessTier", + "modelAsExtensible": true, + "values": [ + { + "value": "Archive", + "description": "Archive Access Tier shares requested by the customer." + } + ] + } + } + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + }, + "datacenterAddressRequest": { + "$ref": "#/definitions/DatacenterAddressRequest", + "description": "Request body to get the datacenter address for given sku." + }, + "deviceCapabilityRequest": { + "$ref": "#/definitions/DeviceCapabilityRequest", + "description": "Request body to get the device capabilities for a given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + }, + "datacenterAddressResponse": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address for given sku in a region.", + "readOnly": true + }, + "deviceCapabilityResponse": { + "$ref": "#/definitions/DeviceCapabilityResponse", + "description": "Device capabilities available for a given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ReverseShippingDetails": { + "description": "Reverse Shipping Address and contact details for a job.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactInfo" + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress" + }, + "isUpdated": { + "description": "A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared.\r\nRead only field", + "type": "boolean", + "readOnly": true + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + }, + "skipAddressValidation": { + "type": "boolean", + "description": "Flag to indicate if customer has chosen to skip default address validation" + }, + "taxIdentificationNumber": { + "type": "string", + "description": "Tax Identification Number" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + }, + "countriesWithinCommerceBoundary": { + "description": "List of all the Countries in the SKU specific commerce boundary", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + }, + "isUpdated": { + "description": "Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + "type": "boolean", + "readOnly": true + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails" + }, + "preferences": { + "$ref": "#/definitions/Preferences" + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package details of job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/preview/2024-03-01-preview/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/preview/2024-03-01-preview/databox.json new file mode 100644 index 00000000000..b3d92a56f82 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/preview/2024-03-01-preview/databox.json @@ -0,0 +1,7311 @@ +{ + "swagger": "2.0", + "info": { + "version": "2024-03-01-preview", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mark devices for a given job as shipped", + "operationId": "Jobs_MarkDevicesShipped", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "markDevicesShippedRequest", + "in": "body", + "description": "Mark Devices Shipped Request", + "required": true, + "schema": { + "$ref": "#/definitions/MarkDevicesShippedRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "MarkDevicesShipped": { + "$ref": "./examples/MarkDevicesShipped.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + }, + "JobsGetWaitingForAction": { + "$ref": "./examples/JobsGetWaitingForAction.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "description": "This class represents additional info which Resource Providers pass when an error occurs.", + "properties": { + "info": { + "description": "Additional information of the type of error.", + "type": "object" + }, + "type": { + "description": "Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation).", + "type": "string" + } + }, + "type": "object" + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Provides additional information about an http error response.", + "properties": { + "additionalInfo": { + "description": "Gets or sets additional error info.", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true, + "type": "array" + }, + "code": { + "description": "Error code.", + "type": "string" + }, + "details": { + "description": "Gets or sets details for the error.", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true, + "type": "array" + }, + "message": { + "description": "The error message parsed from the body of the http error response.", + "type": "string" + }, + "target": { + "description": "Gets or sets the target of the error.", + "type": "string" + } + }, + "type": "object" + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "ContactInfo": { + "description": "Contact Info.", + "required": [ + "contactName", + "phone" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "minLength": 1, + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "minLength": 1, + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "GranularCopyLogDetails": { + "description": "Granular Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "DataBoxCustomerDiskCopyProgress": { + "description": "DataBox CustomerDisk Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DeviceErasureDetails": { + "description": "Device erasure details with erasure completion status and erasureordestructionlog sas key", + "type": "object", + "properties": { + "deviceErasureStatus": { + "description": "Holds the device erasure completion status", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action for clean up." + } + ] + } + }, + "erasureOrDestructionCertificateSasKey": { + "description": "Shared access key to download cleanup or destruction certificate for device", + "type": "string", + "readOnly": true + } + } + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "GranularCopyProgress": { + "description": "Granular Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "model": { + "$ref": "#/definitions/modelName", + "description": "Error, if any, in the stage", + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataBoxCustomerDiskJobDetails": { + "description": "Customer disk job details.", + "required": [ + "jobDetailsType", + "returnToCustomerPackageDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "importDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for import jobs.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ImportDiskDetails" + } + }, + "exportDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for export jobs.", + "type": "object", + "readOnly": true, + "additionalProperties": { + "$ref": "#/definitions/ExportDiskDetails" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxCustomerDiskCopyProgress" + }, + "readOnly": true + }, + "deliverToDcPackageDetails": { + "description": "Delivery package shipping details.", + "$ref": "#/definitions/PackageCarrierInfo", + "readOnly": true + }, + "returnToCustomerPackageDetails": { + "description": "Return package shipping details.", + "$ref": "#/definitions/PackageCarrierDetails" + }, + "enableManifestBackup": { + "description": "Flag to indicate if disk manifest should be backed-up in the Storage Account.", + "type": "boolean", + "default": false + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "CustomerDiskJobSecrets": { + "description": "The secrets related to customer disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "carrierAccountNumber": { + "description": "Carrier Account Number of the customer", + "type": "string", + "readOnly": true, + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DatacenterAddressInstructionResponse": { + "description": "Datacenter instruction for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "communicationInstruction": { + "description": "Data center communication instruction", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressInstruction" + }, + "DatacenterAddressLocationResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "contactPersonName": { + "description": "Contact person name", + "type": "string", + "readOnly": true + }, + "company": { + "description": "Company name", + "type": "string", + "readOnly": true + }, + "street1": { + "description": "Street address line 1", + "type": "string", + "readOnly": true + }, + "street2": { + "description": "Street address line 2", + "type": "string", + "readOnly": true + }, + "street3": { + "description": "Street address line 3", + "type": "string", + "readOnly": true + }, + "city": { + "description": "City name", + "type": "string", + "readOnly": true + }, + "state": { + "description": "name of the state", + "type": "string", + "readOnly": true + }, + "zip": { + "description": "Zip code", + "type": "string", + "readOnly": true + }, + "country": { + "description": "name of the country", + "type": "string", + "readOnly": true + }, + "phone": { + "description": "Phone number", + "type": "string", + "readOnly": true + }, + "phoneExtension": { + "description": "Phone extension", + "type": "string", + "readOnly": true + }, + "addressType": { + "description": "Address type", + "type": "string", + "readOnly": true + }, + "additionalShippingInformation": { + "description": "Special instruction for shipping", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressLocation" + }, + "DatacenterAddressRequest": { + "description": "Request body to get the datacenter address.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the data center address requested.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "model": { + "$ref": "#/definitions/modelName", + "description": "The model name.", + "readOnly": true + } + } + }, + "DatacenterAddressResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "properties": { + "datacenterAddressType": { + "description": "Data center address type", + "enum": [ + "DatacenterAddressLocation", + "DatacenterAddressInstruction" + ], + "type": "string", + "x-ms-enum": { + "name": "DatacenterAddressType", + "modelAsExtensible": false, + "values": [ + { + "value": "DatacenterAddressLocation", + "description": "Data center address location." + }, + { + "value": "DatacenterAddressInstruction", + "description": "Data center address instruction." + } + ] + } + }, + "supportedCarriersForReturnShipment": { + "description": "List of supported carriers for return shipment.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "dataCenterAzureLocation": { + "description": "Azure Location where the Data Center serves primarily.", + "type": "string", + "readOnly": true + } + }, + "discriminator": "datacenterAddressType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxCustomerDiskCopyLogDetails": { + "description": "Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskGranularCopyLogDetails": { + "description": "Granular Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "accountId": { + "description": "Account id.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "DataBoxDiskGranularCopyProgress": { + "description": "DataBox Disk Granular Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "granularCopyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyProgress" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "granularCopyLogDetails": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyLogDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "model": { + "$ref": "#/definitions/modelName", + "description": "The model name.", + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DeviceCapabilityDetails": { + "description": "Device capability details for a given sku for a given region.", + "type": "object", + "properties": { + "hardwareEncryption": { + "description": "Hardware encryption support for a given sku for a given region.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "HardwareEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Hardware-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Hardware-based encryption is disabled." + } + ] + } + } + } + }, + "DeviceCapabilityRequest": { + "description": "Request body to get the device capabilities for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "model": { + "$ref": "#/definitions/modelName", + "description": "The model name.", + "readOnly": true + } + } + }, + "DeviceCapabilityResponse": { + "description": "Device capabilities for given sku in a region", + "type": "object", + "properties": { + "deviceCapabilityDetails": { + "description": "List of device capabilities available for a given region and a given sku", + "type": "array", + "items": { + "$ref": "#/definitions/DeviceCapabilityDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + }, + "hardwareEncryption": { + "description": "Defines Hardware level encryption (Only for disk)", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "HardwareEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Hardware-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Hardware-based encryption is enabled." + } + ] + } + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "ExportDiskDetails": { + "description": "Export disk details", + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "ImportDiskDetails": { + "description": "Import disk details", + "required": [ + "manifestFile", + "manifestHash", + "bitLockerKey" + ], + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string" + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string" + }, + "bitLockerKey": { + "description": "BitLocker key used to encrypt the disk.", + "type": "string", + "x-ms-secret": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDelayDetails": { + "description": "Job Delay Notification details", + "type": "object", + "properties": { + "status": { + "description": "Status of notification", + "enum": [ + "Active", + "Resolved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DelayNotificationStatus", + "modelAsString": true, + "values": [ + { + "value": "Active", + "description": "Delay is still active" + }, + { + "value": "Resolved", + "description": "Delay has been resolved" + } + ] + } + }, + "errorCode": { + "description": "Delay Error code", + "enum": [ + "InternalIssueDelay", + "ActiveOrderLimitBreachedDelay", + "HighDemandDelay", + "LargeNumberOfFilesDelay" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "PortalDelayErrorCode", + "modelAsString": true, + "values": [ + { + "value": "InternalIssueDelay", + "description": "Delay due to any internal reasons" + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "Active Order limit breached." + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "High demand" + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "Slow copy due to large number of files" + } + ] + } + }, + "description": { + "description": "Description of the delay.", + "type": "string", + "readOnly": true + }, + "startTime": { + "format": "date-time", + "description": "Timestamp when the delay notification was created.", + "type": "string", + "readOnly": true + }, + "resolutionTime": { + "format": "date-time", + "description": "Timestamp when the delay notification was resolved.", + "type": "string", + "readOnly": true + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails", + "description": "Optional Reverse Shipping details for order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "deviceErasureDetails": { + "$ref": "#/definitions/DeviceErasureDetails", + "description": "Holds device data erasure details", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + }, + "datacenterAddress": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address to ship to, for the given sku and storage location.", + "readOnly": true + }, + "dataCenterCode": { + "description": "DataCenter code.", + "enum": [ + "Invalid", + "BY2", + "BY1", + "ORK70", + "AM2", + "AMS20", + "BY21", + "BY24", + "MWH01", + "AMS06", + "SSE90", + "SYD03", + "SYD23", + "CBR20", + "YTO20", + "CWL20", + "LON24", + "BOM01", + "BL20", + "BL7", + "SEL20", + "TYO01", + "BN1", + "SN5", + "CYS04", + "TYO22", + "YTO21", + "YQB20", + "FRA22", + "MAA01", + "CPQ02", + "CPQ20", + "SIN20", + "HKG20", + "SG2", + "MEL23", + "SEL21", + "OSA20", + "SHA03", + "BJB", + "JNB22", + "JNB21", + "MNZ21", + "SN8", + "AUH20", + "ZRH20", + "PUS20", + "AdHoc", + "CH1", + "DSM05", + "DUB07", + "PNQ01", + "SVG20", + "OSA02", + "OSA22", + "PAR22", + "BN7", + "SN6", + "BJS20", + "BL24", + "IDC5", + "TYO23", + "NTG20", + "DXB23", + "DSM11", + "AMS25", + "CPQ21", + "OSA23" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataCenterCode", + "modelAsString": true, + "values": [ + { + "value": "Invalid" + }, + { + "value": "BY2" + }, + { + "value": "BY1" + }, + { + "value": "ORK70" + }, + { + "value": "AM2" + }, + { + "value": "AMS20" + }, + { + "value": "BY21" + }, + { + "value": "BY24" + }, + { + "value": "MWH01" + }, + { + "value": "AMS06" + }, + { + "value": "SSE90" + }, + { + "value": "SYD03" + }, + { + "value": "SYD23" + }, + { + "value": "CBR20" + }, + { + "value": "YTO20" + }, + { + "value": "CWL20" + }, + { + "value": "LON24" + }, + { + "value": "BOM01" + }, + { + "value": "BL20" + }, + { + "value": "BL7" + }, + { + "value": "SEL20" + }, + { + "value": "TYO01" + }, + { + "value": "BN1" + }, + { + "value": "SN5" + }, + { + "value": "CYS04" + }, + { + "value": "TYO22" + }, + { + "value": "YTO21" + }, + { + "value": "YQB20" + }, + { + "value": "FRA22" + }, + { + "value": "MAA01" + }, + { + "value": "CPQ02" + }, + { + "value": "CPQ20" + }, + { + "value": "SIN20" + }, + { + "value": "HKG20" + }, + { + "value": "SG2" + }, + { + "value": "MEL23" + }, + { + "value": "SEL21" + }, + { + "value": "OSA20" + }, + { + "value": "SHA03" + }, + { + "value": "BJB" + }, + { + "value": "JNB22" + }, + { + "value": "JNB21" + }, + { + "value": "MNZ21" + }, + { + "value": "SN8" + }, + { + "value": "AUH20" + }, + { + "value": "ZRH20" + }, + { + "value": "PUS20" + }, + { + "value": "AdHoc" + }, + { + "value": "CH1" + }, + { + "value": "DSM05" + }, + { + "value": "DUB07" + }, + { + "value": "PNQ01" + }, + { + "value": "SVG20" + }, + { + "value": "OSA02" + }, + { + "value": "OSA22" + }, + { + "value": "PAR22" + }, + { + "value": "BN7" + }, + { + "value": "SN6" + }, + { + "value": "BJS20" + }, + { + "value": "BL24" + }, + { + "value": "IDC5" + }, + { + "value": "TYO23" + }, + { + "value": "CPQ21" + }, + { + "value": "NTG20" + }, + { + "value": "DXB23" + }, + { + "value": "DSM11" + }, + { + "value": "OSA23" + }, + { + "value": "AMS25" + } + ] + } + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "reverseShippingDetailsUpdate": { + "description": "The Editable status for Reverse Shipping Address and Contact Info", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseShippingDetailsEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse shipping details can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse shipping details." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse shipping details. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "reverseTransportPreferenceUpdate": { + "description": "The Editable status for Reverse Transport preferences", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseTransportPreferenceEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse Transport Preferences can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse Transport Preferences." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse Transport Preferences. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "delayedStage": { + "description": "Name of the stage where delay might be present.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + }, + "allDevicesLost": { + "description": "Flag to indicate if all devices associated with the job are lost.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + }, + "delayInformation": { + "description": "Delay information for the job stages.", + "type": "array", + "items": { + "$ref": "#/definitions/JobDelayDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "MarkDevicesShippedRequest": { + "description": "The request body to provide the delivery package details of job", + "required": [ + "deliverToDcPackageDetails" + ], + "type": "object", + "properties": { + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package details" + } + } + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "serialNumberCustomerResolutionMap": { + "description": "Serial number and the customer resolution code corresponding to each serial number", + "type": "object", + "additionalProperties": { + "format": "int32", + "description": "Available customer resolution codes on a job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job" + }, + { + "value": "Restart", + "description": "Restart whole action" + }, + { + "value": "ReachOutToOperation", + "description": "Reach out to operation for further action" + } + ] + } + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Created", + "ShippedToCustomer" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsString": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + }, + { + "value": "Created", + "description": "Notification at job created stage." + }, + { + "value": "ShippedToCustomer", + "description": "Notification at shipped devices to customer stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageCarrierDetails": { + "description": "Package carrier details.", + "type": "object", + "properties": { + "carrierAccountNumber": { + "description": "Carrier Account Number of customer for customer disk.", + "type": "string", + "x-ms-secret": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageCarrierInfo": { + "description": "package carrier info", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageShippingDetails": { + "description": "package shipping details", + "type": "object", + "properties": { + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "reverseTransportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Optional Preferences related to the reverse shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + }, + "storageAccountAccessTierPreferences": { + "description": "Preferences related to the Access Tier of storage accounts.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "Archive" + ], + "type": "string", + "x-ms-enum": { + "name": "StorageAccountAccessTier", + "modelAsExtensible": true, + "values": [ + { + "value": "Archive", + "description": "Archive Access Tier shares requested by the customer." + } + ] + } + } + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "model": { + "$ref": "#/definitions/modelName", + "description": "The model name.", + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + }, + "datacenterAddressRequest": { + "$ref": "#/definitions/DatacenterAddressRequest", + "description": "Request body to get the datacenter address for given sku." + }, + "deviceCapabilityRequest": { + "$ref": "#/definitions/DeviceCapabilityRequest", + "description": "Request body to get the device capabilities for a given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + }, + "datacenterAddressResponse": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address for given sku in a region.", + "readOnly": true + }, + "deviceCapabilityResponse": { + "$ref": "#/definitions/DeviceCapabilityResponse", + "description": "Device capabilities available for a given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ReverseShippingDetails": { + "description": "Reverse Shipping Address and contact details for a job.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactInfo" + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress" + }, + "isUpdated": { + "description": "A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared.\r\nRead only field", + "type": "boolean", + "readOnly": true + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + }, + "model": { + "$ref": "#/definitions/modelName", + "description": "The model name.", + "readOnly": true + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + }, + "skipAddressValidation": { + "type": "boolean", + "description": "Flag to indicate if customer has chosen to skip default address validation" + }, + "taxIdentificationNumber": { + "type": "string", + "description": "Tax Identification Number" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + }, + "model": { + "$ref": "#/definitions/modelName", + "description": "The model name.", + "readOnly": true + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "model": { + "$ref": "#/definitions/modelName", + "description": "The model name.", + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + }, + "individualSkuUsable": { + "type": "string", + "description": "Maximum capacity per device in TB.", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + }, + "countriesWithinCommerceBoundary": { + "description": "List of all the Countries in the SKU specific commerce boundary", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "model": { + "$ref": "#/definitions/modelName", + "description": "The model name.", + "readOnly": true + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + }, + "isUpdated": { + "description": "Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + "type": "boolean", + "readOnly": true + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails" + }, + "preferences": { + "$ref": "#/definitions/Preferences" + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package details of job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "model": { + "$ref": "#/definitions/modelName", + "description": "The model name.", + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + }, + "modelName": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk", + "DataBoxV2x100", + "DataBoxV2x500" + ], + "type": "string", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. DataBoxV2x100 and DataBoxV2x500 as of May/2024", + "x-ms-enum": { + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + }, + { + "value": "DataBoxV2x100", + "description": "Data Box V2 100TB." + }, + { + "value": "DataBoxV2x500", + "description": "Data Box V2 500TB." + } + ] + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.az.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.az.md new file mode 100644 index 00000000000..8b71862eff6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.az.md @@ -0,0 +1,12 @@ +## CLI + +These settings apply only when `--az` is specified on the command line. + +``` yaml $(az) +az: + extensions: databox + package-name: azure-mgmt-databox + namespace: azure.mgmt.databox +az-output-folder: $(azure-cli-extension-folder)/src/databox +python-sdk-output-folder: "$(az-output-folder)/azext_databox/vendored_sdks/databox" +``` diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.cli.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.cli.md new file mode 100644 index 00000000000..832fd57e0f6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.cli.md @@ -0,0 +1,36 @@ +## CLI + +These settings apply only when `--cli` is specified on the command line. + +``` yaml $(cli) +cli: + cli-name: databox + package-name: azure-mgmt-databox + namespace: azure.mgmt.databox + test-scenario: + - name: JobsCreate + - name: JobsGet6 + - name: JobsGet5 + - name: JobsGet4 + - name: JobsGet3 + - name: JobsGet2 + - name: JobsGet1 + - name: JobsGet + - name: JobsListByResourceGroup + - name: JobsList + - name: OperationsGet + - name: ServiceValidateInputsByResourceGroup + - name: AvailableSkusByResourceGroup + - name: BookShipmentPickupPost + - name: JobsListCredentials + - name: JobsCancelPost + - name: JobsPatch + - name: ServiceRegionConfiguration + - name: ValidateAddressPost + - name: ServiceValidateInputs + - name: AvailableSkusPost + - name: JobsDelete + - name: JobMitigate + - name: JobsGetWaitingForAction + - name: MarkDevicesShipped +``` \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.go.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.go.md new file mode 100644 index 00000000000..4b73f045ac1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.go.md @@ -0,0 +1,21 @@ +## Go + +These settings apply only when `--go` is specified on the command line. + +``` yaml $(go) && $(track2) +license-header: MICROSOFT_MIT_NO_VERSION +module-name: sdk/resourcemanager/databox/armdatabox +module: github.com/Azure/azure-sdk-for-go/$(module-name) +output-folder: $(go-sdk-folder)/$(module-name) +azure-arm: true +directive: +- rename-model: + from: 'JobDetails' + to: 'CommonJobDetails' +- rename-model: + from: 'JobSecrets' + to: 'CommonJobSecrets' +- rename-model: + from: 'ScheduleAvailabilityRequest' + to: 'CommonScheduleAvailabilityRequest' +``` diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.java.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.java.md new file mode 100644 index 00000000000..21cda24fcc1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.java.md @@ -0,0 +1,258 @@ +## Java + +These settings apply only when `--java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(java) +java: + azure-arm: true + fluent: true + namespace: com.microsoft.azure.management.databox + license-header: MICROSOFT_MIT_NO_CODEGEN + payload-flattening-threshold: 1 + output-folder: $(azure-libraries-for-java-folder)/azure-mgmt-databox +``` + +### Java multi-api + +``` yaml $(java) && $(multiapi) +batch: + - tag: package-2018-01 + - tag: package-2019-09 + - tag: package-2020-04 + - tag: package-2020-11 + - tag: package-2021-03 + - tag: package-2021-05 + - tag: package-2021-08-preview + - tag: package-2021-12 + - tag: package-2022-02 + - tag: package-2022-09 + - tag: package-2022-10 + - tag: package-2022-12 + - tag: package-2023-03 + - tag: package-2023-12 + - tag: package-2024-02-preview + - tag: package-2024-03-preview + - tag: package-2025-02 +``` + +### Tag: package-2018-01 and java + +These settings apply only when `--tag=package-2018-01 --java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2018-01' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2018_01_01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2018_01_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2019-09 and java + +These settings apply only when `--tag=package-2019-09-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2019-09' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2019_09-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2019_09_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2020-04 and java + +These settings apply only when `--tag=package-2020-04-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2020-04' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2020_04-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2020_04_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2020-11 and java + +These settings apply only when `--tag=package-2020-11-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2020-11' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2020_11-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2020_11_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2021-03 and java + +These settings apply only when `--tag=package-2021-03-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2021-03' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2021_03-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2021_03_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2021-05 and java + +These settings apply only when `--tag=package-2021-05-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2021-05' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2021_05-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2021_05_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2021-08-preview and java + +These settings apply only when `--tag=package-2021-08-preview-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2021-08-preview' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2021_08-01-preview + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2021_08_01_preview +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2021-12 and java + +These settings apply only when `--tag=package-2021-12-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2021-12' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2021_12-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2021_12_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2022-02 and java + +These settings apply only when `--tag=package-2022-02-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2022-02' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2022_02-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2022_02_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2022-09 and java + +These settings apply only when `--tag=package-2022-09-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2022-09' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2022_09-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2022_09_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2022-10 and java + +These settings apply only when `--tag=package-2022-10-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2022-10' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2022_10-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2022_10_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2022-12 and java + +These settings apply only when `--tag=package-2022-12-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2022-12' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2022_12-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2022_12_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2023-03 and java + +These settings apply only when `--tag=package-2023-03-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2023-03' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2023_03-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2023_03_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2023-12 and java + +These settings apply only when `--tag=package-2023-12-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2023-12' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2023_12-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2023_12_01 +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2024-02-preview and java + +These settings apply only when `--tag=package-2024-02-preview-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2024-02-preview' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2024_02-01-preview + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2024_02_01_preview +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2024-03-preview and java + +These settings apply only when `--tag=package-2024-03-preview-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2024-03-preview' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2024_03-01-preview + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2024_03_01_preview +regenerate-manager: true +generate-interface: true +``` + +### Tag: package-2025-02 and java + +These settings apply only when `--tag=package-2025-02-java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(tag) == 'package-2025-02' && $(java) && $(multiapi) +java: + namespace: com.microsoft.azure.management.databox.v2025_02-01 + output-folder: $(azure-libraries-for-java-folder)/sdk/databox/mgmt-v2025_02_01 +regenerate-manager: true +generate-interface: true +``` \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.md new file mode 100644 index 00000000000..7df5bb43e56 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.md @@ -0,0 +1,236 @@ +# DataBox + +> see https://aka.ms/autorest + +This is the AutoRest configuration file for DataBox. + + + +--- +## Getting Started +To build the SDK for DataBox, simply [Install AutoRest](https://aka.ms/autorest/install) and in this folder, run: + +> `autorest` + +To see additional help and options, run: + +> `autorest --help` +--- + +## Configuration + + + +### Basic Information +These are the global settings for the DataBox API. + +``` yaml +openapi-type: arm +tag: package-2025-07 +``` +### Tag: package-2025-07 + +These settings apply only when `--tag=package-2025-07` is specified on the command line. + +``` yaml $(tag) == 'package-2025-07' +input-file: +- stable/2025-07-01/databox.json +``` + +### Tag: package-2025-02 + +These settings apply only when `--tag=package-2025-02` is specified on the command line. + +``` yaml $(tag) == 'package-2025-02' +input-file: +- stable/2025-02-01/databox.json +``` + +### Tag: package-2024-03-preview + +These settings apply only when `--tag=package-2024-03-preview` is specified on the command line. + +``` yaml $(tag) == 'package-2024-03-preview' +input-file: +- preview/2024-03-01-preview/databox.json +``` + +### Tag: package-2024-02-preview + +These settings apply only when `--tag=package-2024-02-preview` is specified on the command line. + +``` yaml $(tag) == 'package-2024-02-preview' +input-file: +- preview/2024-02-01-preview/databox.json +``` + +### Tag: package-2023-12 + +These settings apply only when `--tag=package-2023-12` is specified on the command line. + +``` yaml $(tag) == 'package-2023-12' +input-file: +- stable/2023-12-01/databox.json +``` + +### Tag: package-2023-03 + +These settings apply only when `--tag=package-2023-03` is specified on the command line. + +``` yaml $(tag) == 'package-2023-03' +input-file: +- stable/2023-03-01/databox.json +``` + +### Tag: package-2022-12 + +These settings apply only when `--tag=package-2022-12` is specified on the command line. + +``` yaml $(tag) == 'package-2022-12' +input-file: +- stable/2022-12-01/databox.json +``` + + +### Tag: package-2022-10 + +These settings apply only when `--tag=package-2022-10` is specified on the command line. + +``` yaml $(tag) == 'package-2022-10' +input-file: +- stable/2022-10-01/databox.json +``` + +### Tag: package-2022-09 + +These settings apply only when `--tag=package-2022-09` is specified on the command line. + +``` yaml $(tag) == 'package-2022-09' +input-file: +- stable/2022-09-01/databox.json +``` + +### Tag: package-2022-02 + +These settings apply only when `--tag=package-2022-02` is specified on the command line. + +``` yaml $(tag) == 'package-2022-02' +input-file: +- stable/2022-02-01/databox.json +``` + +### Tag: package-2021-12 + +These settings apply only when `--tag=package-2021-12` is specified on the command line. + +``` yaml $(tag) == 'package-2021-12' +input-file: +- stable/2021-12-01/databox.json +``` + +### Tag: package-2021-08-preview + +These settings apply only when `--tag=package-2021-08-preview` is specified on the command line. + +``` yaml $(tag) == 'package-2021-08-preview' +input-file: +- preview/2021-08-01-preview/databox.json +``` + +### Tag: package-2021-05 + +These settings apply only when `--tag=package-2021-05` is specified on the command line. + +``` yaml $(tag) == 'package-2021-05' +input-file: +- stable/2021-05-01/databox.json +``` + +### Tag: package-2021-03 + +These settings apply only when `--tag=package-2021-03` is specified on the command line. + +``` yaml $(tag) == 'package-2021-03' +input-file: +- stable/2021-03-01/databox.json +``` + +### Tag: package-2020-11 + +These settings apply only when `--tag=package-2020-11` is specified on the command line. + +``` yaml $(tag) == 'package-2020-11' +input-file: +- stable/2020-11-01/databox.json +``` + +### Tag: package-2020-04 + +These settings apply only when `--tag=package-2020-04` is specified on the command line. + +``` yaml $(tag) == 'package-2020-04' +input-file: +- stable/2020-04-01/databox.json +``` + +### Tag: package-2019-09 + +These settings apply only when `--tag=package-2019-09` is specified on the command line. + +``` yaml $(tag) == 'package-2019-09' +input-file: +- stable/2019-09-01/databox.json +``` + +### Tag: package-2018-01 + +These settings apply only when `--tag=package-2018-01` is specified on the command line. + +``` yaml $(tag) == 'package-2018-01' +input-file: +- stable/2018-01-01/databox.json +``` + +--- +# Code Generation + + +## Swagger to SDK + +This section describes what SDK should be generated by the automatic system. +This is not used by Autorest itself. + +``` yaml $(swagger-to-sdk) +swagger-to-sdk: + - repo: azure-sdk-for-net + - repo: azure-sdk-for-python + - repo: azure-sdk-for-js + - repo: azure-sdk-for-node + - repo: azure-sdk-for-go + - repo: azure-sdk-for-java + - repo: azure-sdk-for-ruby + after_scripts: + - bundle install && rake arm:regen_all_profiles['azure_mgmt_databox'] + - repo: azure-cli-extensions + - repo: azure-resource-manager-schemas + - repo: azure-powershell +``` + +## Python + +See configuration in [readme.python.md](./readme.python.md) + +## Ruby + +See configuration in [readme.ruby.md](./readme.ruby.md) + +## Go + +See configuration in [readme.go.md](./readme.go.md) + +## Java + +See configuration in [readme.java.md](./readme.java.md) + + + diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.nodejs.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.nodejs.md new file mode 100644 index 00000000000..58dd61126fd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.nodejs.md @@ -0,0 +1,16 @@ +## Node.js + +These settings apply only when `--nodejs` is specified on the command line. +Please also specify `--node-sdks-folder=`. + +``` yaml $(nodejs) +nodejs: + azure-arm: true + license-header: MICROSOFT_MIT_NO_VERSION + payload-flattening-threshold: 2 + package-name: azure-arm-databox + output-folder: $(node-sdks-folder)/lib/services/databoxManagement + generate-license-txt: true + generate-package-json: true + generate-readme-md: false +``` diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.python.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.python.md new file mode 100644 index 00000000000..d3cddf5b0f0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.python.md @@ -0,0 +1,20 @@ +## Python + +These settings apply only when `--python` is specified on the command line. +Please also specify `--python-sdks-folder=`. + +``` yaml $(python) +azure-arm: true +license-header: MICROSOFT_MIT_NO_VERSION +package-name: azure-mgmt-databox +namespace: azure.mgmt.databox +package-version: 3.0.0 +clear-output-folder: true +title: DataBoxManagementClient +description: The DataBox Client. +``` + +``` yaml $(python) +no-namespace-folders: true +output-folder: $(python-sdks-folder)/databox/azure-mgmt-databox/azure/mgmt/databox +``` diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.typescript.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.typescript.md new file mode 100644 index 00000000000..8e6f88e9699 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/readme.typescript.md @@ -0,0 +1,14 @@ +## TypeScript + +These settings apply only when `--typescript` is specified on the command line. +Please also specify `--typescript-sdks-folder=`. + +``` yaml $(typescript) +typescript: + azure-arm: true + license-header: MICROSOFT_MIT_NO_VERSION + payload-flattening-threshold: 2 + package-name: "@azure/arm-databox" + output-folder: "$(typescript-sdks-folder)/sdk/databox/arm-databox" + generate-metadata: true +``` diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/routes.tsp b/tests-upgrade/tests-emitter/DataBox.Management.brown/routes.tsp new file mode 100644 index 00000000000..39f12315e9b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/routes.tsp @@ -0,0 +1,110 @@ +// FIXME: Operations in this file are not detected as a resource operation, please confirm the conversion result manually + +import "@azure-tools/typespec-azure-core"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "./models.tsp"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using Azure.ResourceManager; +using TypeSpec.OpenAPI; + +namespace Microsoft.DataBox; + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface ServiceOperationGroup { + /** + * This API provides configuration details specific to given region/location at Subscription level. + */ + @autoRoute + regionConfiguration is ArmProviderActionSync< + Request = RegionConfigurationRequest, + Response = RegionConfigurationResponse, + Scope = SubscriptionActionScope, + Parameters = LocationResourceParameter, + Error = ApiError + >; + + /** + * [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any. + */ + #deprecated "This operation will soon be removed" + @autoRoute + validateAddress is ArmProviderActionSync< + Request = ValidateAddress, + Response = AddressValidationOutput, + Scope = SubscriptionActionScope, + Parameters = LocationResourceParameter, + Error = ApiError + >; + + /** + * This method does all necessary pre-job creation validation under subscription. + */ + @autoRoute + validateInputs is ArmProviderActionSync< + Request = ValidationRequest, + Response = ValidationResponse, + Scope = SubscriptionActionScope, + Parameters = LocationResourceParameter, + Error = ApiError + >; + + /** + * This method provides the list of available skus for the given subscription, resource group and location. + */ + @route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus") + @post + @list + listAvailableSkusByResourceGroup( + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + ...LocationResourceParameter, + + /** + * Filters for showing the available skus. + */ + @bodyRoot + availableSkuRequest: AvailableSkuRequest, + ): ArmResponse | ApiError; + + /** + * This API provides configuration details specific to given region/location at Resource group level. + */ + @route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration") + @post + regionConfigurationByResourceGroup( + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + ...LocationResourceParameter, + + /** + * Request body to get the configuration for the region at resource group level. + */ + @bodyRoot + regionConfigurationRequest: RegionConfigurationRequest, + ): ArmResponse | ApiError; + + /** + * This method does all necessary pre-job creation validation under resource group. + */ + @route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs") + @post + validateInputsByResourceGroup( + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...ResourceGroupParameter, + ...LocationResourceParameter, + + /** + * Inputs of the customer. + */ + @bodyRoot + validationRequest: ValidationRequest, + ): ArmResponse | ApiError; +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2018-01-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2018-01-01/databox.json new file mode 100644 index 00000000000..5520d404b83 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2018-01-01/databox.json @@ -0,0 +1,2725 @@ +{ + "swagger": "2.0", + "info": { + "version": "2018-01-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription and location.", + "operationId": "Service_ListAvailableSkus", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + } + }, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGet1": { + "$ref": "./examples/JobsGet1.json" + }, + "JobsGet2": { + "$ref": "./examples/JobsGet2.json" + }, + "JobsGet3": { + "$ref": "./examples/JobsGet3.json" + }, + "JobsGet4": { + "$ref": "./examples/JobsGet4.json" + }, + "JobsGet5": { + "$ref": "./examples/JobsGet5.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "202": { + "description": "Accepted request for delete Job." + }, + "204": { + "description": "Job deleted." + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated." + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "type": "object", + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "DataBox." + }, + { + "value": "DataBoxDisk", + "description": "DataBoxDisk." + }, + { + "value": "DataBoxHeavy", + "description": "DataBoxHeavy." + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "DataBox orders." + }, + { + "value": "DataBoxDisk", + "description": "DataBoxDisk orders." + }, + { + "value": "DataBoxHeavy", + "description": "DataBoxHeavy orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesSentToCloud": { + "format": "int64", + "description": "Amount of data uploaded by the job as of now.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed by the job as of now.", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total number of files to be processed by the job.", + "type": "integer", + "readOnly": true + } + } + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Destination account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "shippingAddress", + "destinationAccountDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for DataBoxHeavy", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Destination account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "DataBoxHeavy Device Job Details", + "required": [ + "contactDetails", + "shippingAddress", + "destinationAccountDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a DataBoxHeavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a DataBoxHeavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a DataBoxHeavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "DataBox Job Details", + "required": [ + "contactDetails", + "shippingAddress", + "destinationAccountDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a DataBox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DestinationAccountDetails": { + "description": "Details of the destination of the data", + "required": [ + "dataDestinationType" + ], + "type": "object", + "properties": { + "dataDestinationType": { + "description": "Data Destination Type.", + "enum": [ + "UnknownType", + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataDestinationType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown type." + }, + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Arm Id of the destination where the data has to be moved.", + "type": "string" + } + }, + "discriminator": "dataDestinationType" + }, + "DestinationManagedDiskDetails": { + "description": "Details for the destination compute disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataDestinationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DestinationAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Destination Resource Group Id where the Compute disks should be created.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Arm Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "DestinationStorageAccountDetails": { + "description": "Details for the destination storage account.", + "required": [ + "storageAccountId", + "dataDestinationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DestinationAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Destination Storage Account Arm Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "DestinationToServiceLocationMap": { + "description": "Map of destination location to service location", + "type": "object", + "properties": { + "destinationLocation": { + "description": "Location of the destination.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "Error": { + "description": "Top level error for the job.", + "type": "object", + "properties": { + "code": { + "description": "Error code that can be used to programmatically identify the error.", + "type": "string", + "readOnly": true + }, + "message": { + "description": "Describes the error in detail and provides debugging information.", + "type": "string", + "readOnly": true + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "shippingAddress", + "destinationAccountDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "destinationAccountDetails": { + "description": "Destination account details.", + "type": "array", + "items": { + "$ref": "#/definitions/DestinationAccountDetails" + } + }, + "errorDetails": { + "description": "Error details for failure. This is optional.", + "type": "array", + "items": { + "$ref": "#/definitions/JobErrorDetails" + }, + "readOnly": true + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "DataBox orders." + }, + { + "value": "DataBoxDisk", + "description": "DataBoxDisk orders." + }, + { + "value": "DataBoxHeavy", + "description": "DataBoxHeavy orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + } + }, + "discriminator": "jobDetailsType" + }, + "JobErrorDetails": { + "description": "Job Error Details for providing the information and recommended action.", + "type": "object", + "properties": { + "errorMessage": { + "description": "Message for the error.", + "type": "string", + "readOnly": true + }, + "errorCode": { + "format": "int32", + "description": "Code for the error.", + "type": "integer", + "readOnly": true + }, + "recommendedAction": { + "description": "Recommended action for the error.", + "type": "string", + "readOnly": true + }, + "exceptionMessage": { + "description": "Contains the non localized exception message", + "type": "string", + "readOnly": true + } + } + }, + "JobProperties": { + "description": "Job Properties", + "type": "object", + "properties": { + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/Error", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "DataBox orders." + }, + { + "value": "DataBoxDisk", + "description": "DataBoxDisk orders." + }, + { + "value": "DataBoxHeavy", + "description": "DataBoxHeavy orders." + } + ] + } + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + }, + "errorDetails": { + "description": "Error details for the stage.", + "type": "array", + "items": { + "$ref": "#/definitions/JobErrorDetails" + }, + "readOnly": true + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageShippingDetails": { + "description": "Shipping details.", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + }, + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + } + }, + "x-ms-azure-resource": true + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "StorSimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country", + "postalCode" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "DataBox." + }, + { + "value": "DataBoxDisk", + "description": "DataBoxDisk." + }, + { + "value": "DataBoxHeavy", + "description": "DataBoxHeavy." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "destinationToServiceLocationMap": { + "description": "The map of destination location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DestinationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + }, + "destinationAccountDetails": { + "description": "Destination account details.", + "type": "array", + "items": { + "$ref": "#/definitions/DestinationAccountDetails" + } + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType" + ], + "type": "object", + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "DataBox." + }, + { + "value": "DataBoxDisk", + "description": "DataBoxDisk." + }, + { + "value": "DataBoxHeavy", + "description": "DataBoxHeavy." + } + ] + } + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2019-09-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2019-09-01/databox.json new file mode 100644 index 00000000000..3a6efd29efd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2019-09-01/databox.json @@ -0,0 +1,4163 @@ +{ + "swagger": "2.0", + "info": { + "version": "2019-09-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription and location.", + "operationId": "Service_ListAvailableSkus", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under subscription.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusByResourceGroup": { + "$ref": "./examples/AvailableSkusPostByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed] This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "ServiceValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "ServiceValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGet1": { + "$ref": "./examples/JobsGet1.json" + }, + "JobsGet2": { + "$ref": "./examples/JobsGet2.json" + }, + "JobsGet3": { + "$ref": "./examples/JobsGet3.json" + }, + "JobsGet4": { + "$ref": "./examples/JobsGet4.json" + }, + "JobsGet5": { + "$ref": "./examples/JobsGet5.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "202": { + "description": "Accepted request for delete Job." + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "ServiceRegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataDestinationType": { + "description": "Data Destination Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataDestinationType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Databox." + }, + { + "value": "DataBoxDisk", + "description": "DataboxDisk." + }, + { + "value": "DataBoxHeavy", + "description": "DataboxHeavy." + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Databox orders." + }, + { + "value": "DataBoxDisk", + "description": "DataboxDisk orders." + }, + { + "value": "DataBoxHeavy", + "description": "DataboxHeavy orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "dataDestinationType": { + "description": "Data Destination Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataDestinationType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesSentToCloud": { + "format": "int64", + "description": "Amount of data uploaded by the job as of now.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed by the job as of now.", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total number of files to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + } + } + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Destination account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "shippingAddress", + "destinationAccountDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "required": [ + "jobSecretsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Destination account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "shippingAddress", + "destinationAccountDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "required": [ + "jobSecretsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "shippingAddress", + "destinationAccountDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "required": [ + "jobSecretsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataDestinationDetailsValidationRequest": { + "description": "Request to validate data destination details.", + "required": [ + "destinationAccountDetails", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "destinationAccountDetails": { + "description": "Destination account details list.", + "type": "array", + "items": { + "$ref": "#/definitions/DestinationAccountDetails" + } + }, + "location": { + "description": "Location of stamp or geo.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateDataDestinationDetails" + }, + "DataDestinationDetailsValidationResponseProperties": { + "description": "Properties of data destination details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data destination details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataDestinationDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc Access Security code for device.", + "type": "object", + "properties": { + "forwardDCAccessCode": { + "description": "Dc Access Code for dispatching from DC.", + "type": "string" + }, + "reverseDCAccessCode": { + "description": "Dc Access code for dropping off at DC.", + "type": "string" + } + } + }, + "DestinationAccountDetails": { + "description": "Details of the destination storage accounts.", + "required": [ + "dataDestinationType" + ], + "type": "object", + "properties": { + "dataDestinationType": { + "description": "Data Destination Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataDestinationType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Arm Id of the destination where the data has to be moved.", + "type": "string" + }, + "sharePassword": { + "description": "Share password to be shared by all shares in SA.", + "type": "string" + } + }, + "discriminator": "dataDestinationType" + }, + "DestinationManagedDiskDetails": { + "description": "Details for the destination compute disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataDestinationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DestinationAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Destination Resource Group Id where the Compute disks should be created.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Arm Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "DestinationStorageAccountDetails": { + "description": "Details for the destination storage account.", + "required": [ + "storageAccountId", + "dataDestinationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DestinationAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Destination Storage Account Arm Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "DestinationToServiceLocationMap": { + "description": "Map of destination location to service location.", + "type": "object", + "properties": { + "destinationLocation": { + "description": "Location of the destination.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "expectedDataSizeInTeraBytes", + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "Error": { + "description": "Top level error for the job.", + "type": "object", + "properties": { + "code": { + "description": "Error code that can be used to programmatically identify the error.", + "type": "string", + "readOnly": true + }, + "message": { + "description": "Describes the error in detail and provides debugging information.", + "type": "string", + "readOnly": true + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "shippingAddress", + "destinationAccountDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "destinationAccountDetails": { + "description": "Destination account details.", + "type": "array", + "items": { + "$ref": "#/definitions/DestinationAccountDetails" + } + }, + "errorDetails": { + "description": "Error details for failure. This is optional.", + "type": "array", + "items": { + "$ref": "#/definitions/JobErrorDetails" + }, + "readOnly": true + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Databox orders." + }, + { + "value": "DataBoxDisk", + "description": "DataboxDisk orders." + }, + { + "value": "DataBoxHeavy", + "description": "DataboxHeavy orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + } + }, + "discriminator": "jobDetailsType" + }, + "JobErrorDetails": { + "description": "Job Error Details for providing the information and recommended action.", + "type": "object", + "properties": { + "errorMessage": { + "description": "Message for the error.", + "type": "string", + "readOnly": true + }, + "errorCode": { + "format": "int32", + "description": "Code for the error.", + "type": "integer", + "readOnly": true + }, + "recommendedAction": { + "description": "Recommended action for the error.", + "type": "string", + "readOnly": true + }, + "exceptionMessage": { + "description": "Contains the non localized exception message", + "type": "string", + "readOnly": true + } + } + }, + "JobProperties": { + "description": "Job Properties", + "type": "object", + "properties": { + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/Error", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Databox orders." + }, + { + "value": "DataBoxDisk", + "description": "DataboxDisk orders." + }, + { + "value": "DataBoxHeavy", + "description": "DataboxHeavy orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping" + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + }, + "errorDetails": { + "description": "Error details for the stage.", + "type": "array", + "items": { + "$ref": "#/definitions/JobErrorDetails" + }, + "readOnly": true + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageShippingDetails": { + "description": "Shipping details.", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + }, + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred Data Center Region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference requested with respect to transport type and data center", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + } + }, + "x-ms-azure-resource": true + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. \r\nFor locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability response for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country", + "postalCode" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Databox." + }, + { + "value": "DataBoxDisk", + "description": "DataboxDisk." + }, + { + "value": "DataBoxHeavy", + "description": "DataboxHeavy." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "destinationToServiceLocationMap": { + "description": "The map of destination location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DestinationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + } + } + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + }, + "destinationAccountDetails": { + "description": "Destination account details.", + "type": "array", + "items": { + "$ref": "#/definitions/DestinationAccountDetails" + } + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Databox." + }, + { + "value": "DataBoxDisk", + "description": "DataboxDisk." + }, + { + "value": "DataBoxHeavy", + "description": "DataboxHeavy." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateDataDestinationDetails", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateDataDestinationDetails", + "description": "Identify request and response of data destination details validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "type": "object", + "required": [ + "validationType" + ], + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateDataDestinationDetails", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateDataDestinationDetails", + "description": "Identify request and response of data destination details validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + } + ] + } + }, + "error": { + "$ref": "#/definitions/Error", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Input request for all pre job creation validation.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + }, + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + } + }, + "discriminator": "validationCategory" + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + }, + "CloudError": { + "description": "The error information object.", + "x-ms-external": true, + "properties": { + "code": { + "type": "string", + "readOnly": true, + "description": "Error code string." + }, + "message": { + "type": "string", + "readOnly": true, + "description": "Descriptive error information." + }, + "target": { + "type": "string", + "description": "Error target" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/CloudError" + }, + "description": "More detailed error information." + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2020-04-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2020-04-01/databox.json new file mode 100644 index 00000000000..4d970746a96 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2020-04-01/databox.json @@ -0,0 +1,4698 @@ +{ + "swagger": "2.0", + "info": { + "version": "2020-04-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job." + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "type": "object", + "description": "Additional error info.", + "properties": { + "type": { + "description": "Additional error type.", + "type": "string" + }, + "info": { + "description": "Additional error info.", + "type": "object" + } + } + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Cloud error.", + "type": "object", + "properties": { + "code": { + "description": "Cloud error code.", + "type": "string" + }, + "message": { + "description": "Cloud error message.", + "type": "string" + }, + "target": { + "description": "Cloud error target.", + "type": "string" + }, + "details": { + "description": "Cloud error details.", + "type": "array", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true + }, + "additionalInfo": { + "description": "Cloud error additional info.", + "type": "array", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true + } + }, + "x-ms-external": true + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used.", + "readOnly": true + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageShippingDetails": { + "description": "Shipping details.", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + }, + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country", + "postalCode" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2020-11-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2020-11-01/databox.json new file mode 100644 index 00000000000..1ab7960e9f9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2020-11-01/databox.json @@ -0,0 +1,4832 @@ +{ + "swagger": "2.0", + "info": { + "version": "2020-11-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job." + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "type": "object", + "description": "Additional error info.", + "properties": { + "type": { + "description": "Additional error type.", + "type": "string" + }, + "info": { + "description": "Additional error info.", + "type": "object" + } + } + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Cloud error.", + "type": "object", + "properties": { + "code": { + "description": "Cloud error code.", + "type": "string" + }, + "message": { + "description": "Cloud error message.", + "type": "string" + }, + "target": { + "description": "Cloud error target.", + "type": "string" + }, + "details": { + "description": "Cloud error details.", + "type": "array", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true + }, + "additionalInfo": { + "description": "Cloud error additional info.", + "type": "array", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true + } + }, + "x-ms-external": true + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageShippingDetails": { + "description": "Shipping details.", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + }, + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2021-03-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2021-03-01/databox.json new file mode 100644 index 00000000000..1c199656f16 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2021-03-01/databox.json @@ -0,0 +1,5004 @@ +{ + "swagger": "2.0", + "info": { + "version": "2021-03-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job." + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "type": "object", + "description": "Additional error info.", + "properties": { + "type": { + "description": "Additional error type.", + "type": "string" + }, + "info": { + "description": "Additional error info.", + "type": "object" + } + } + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Cloud error.", + "type": "object", + "properties": { + "code": { + "description": "Cloud error code.", + "type": "string" + }, + "message": { + "description": "Cloud error message.", + "type": "string" + }, + "target": { + "description": "Cloud error target.", + "type": "string" + }, + "details": { + "description": "Cloud error details.", + "type": "array", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true + }, + "additionalInfo": { + "description": "Cloud error additional info.", + "type": "array", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true + } + }, + "x-ms-external": true + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "required": [ + "customerResolutionCode" + ], + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + } + ] + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageShippingDetails": { + "description": "Shipping details.", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + }, + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2021-05-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2021-05-01/databox.json new file mode 100644 index 00000000000..3d9465803f2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2021-05-01/databox.json @@ -0,0 +1,5094 @@ +{ + "swagger": "2.0", + "info": { + "version": "2021-05-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + }, + "JobsGetWaitingForAction": { + "$ref": "./examples/JobsGetWaitingForAction.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job." + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "x-ms-identifiers": [ + "shareName" + ], + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "type": "object", + "description": "Additional error info.", + "properties": { + "type": { + "description": "Additional error type.", + "type": "string" + }, + "info": { + "description": "Additional error info.", + "type": "object" + } + } + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "x-ms-identifiers": [], + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "x-ms-identifiers": [ + "sku" + ], + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Cloud error.", + "type": "object", + "properties": { + "code": { + "description": "Cloud error code.", + "type": "string" + }, + "message": { + "description": "Cloud error message.", + "type": "string" + }, + "target": { + "description": "Cloud error target.", + "type": "string" + }, + "details": { + "description": "Cloud error details.", + "type": "array", + "items": { + "$ref": "#/definitions/CloudError" + }, + "x-ms-identifiers": [ + "message", + "target" + ], + "readOnly": true + }, + "additionalInfo": { + "description": "Cloud error additional info.", + "type": "array", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "x-ms-identifiers": [], + "readOnly": true + } + }, + "x-ms-external": true + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + }, + "x-ms-identifiers": [] + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "x-ms-identifiers": [ + "serialNumber" + ], + "readOnly": true + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "x-ms-identifiers": [ + "diskSerialNumber" + ], + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "x-ms-identifiers": [ + "dataAccountType", + "accountId" + ], + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "x-ms-identifiers": [ + "deviceSerialNumber" + ], + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "x-ms-identifiers": [ + "name" + ], + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "x-ms-identifiers": [ + "accountName" + ], + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "x-ms-identifiers": [ + "dataAccountType", + "accountId" + ], + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + }, + "x-ms-identifiers": [ + "deviceSerialNumber" + ] + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "x-ms-identifiers": [ + "name" + ], + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "x-ms-identifiers": [ + "accountName" + ], + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + }, + "x-ms-identifiers": [] + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + }, + "x-ms-identifiers": [] + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + }, + "x-ms-identifiers": [] + }, + "target": { + "type": "string" + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "x-ms-identifiers": [ + "stageName" + ], + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + }, + "x-ms-identifiers": [] + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + }, + "x-ms-identifiers": [] + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "x-ms-identifiers": [], + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "required": [ + "customerResolutionCode" + ], + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + } + ] + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsExtensible": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "x-ms-identifiers": [ + "name" + ], + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageShippingDetails": { + "description": "Shipping details.", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + }, + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "x-ms-identifiers": [ + "dataLocation" + ], + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "x-ms-identifiers": [ + "meterId" + ], + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + }, + "x-ms-identifiers": [ + "filterFilePath" + ] + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "x-ms-identifiers": [], + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + }, + "x-ms-identifiers": [ + "jobName" + ] + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + }, + "x-ms-identifiers": [] + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "x-ms-identifiers": [], + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2021-12-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2021-12-01/databox.json new file mode 100644 index 00000000000..5d22756dc46 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2021-12-01/databox.json @@ -0,0 +1,6424 @@ +{ + "swagger": "2.0", + "info": { + "version": "2021-12-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mark devices for a given job as shipped", + "operationId": "Jobs_MarkDevicesShipped", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "markDevicesShippedRequest", + "in": "body", + "description": "Mark Devices Shipped Request", + "required": true, + "schema": { + "$ref": "#/definitions/MarkDevicesShippedRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "MarkDevicesShipped": { + "$ref": "./examples/MarkDevicesShipped.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + }, + "JobsGetWaitingForAction": { + "$ref": "./examples/JobsGetWaitingForAction.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job." + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "description": "This class represents additional info which Resource Providers pass when an error occurs.", + "properties": { + "info": { + "description": "Additional information of the type of error.", + "type": "object" + }, + "type": { + "description": "Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation).", + "type": "string" + } + }, + "type": "object" + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Provides additional information about an http error response.", + "properties": { + "additionalInfo": { + "description": "Gets or sets additional error info.", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true, + "type": "array" + }, + "code": { + "description": "Error code.", + "type": "string" + }, + "details": { + "description": "Gets or sets details for the error.", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true, + "type": "array" + }, + "message": { + "description": "The error message parsed from the body of the http error response.", + "type": "string" + }, + "target": { + "description": "Gets or sets the target of the error.", + "type": "string" + } + }, + "type": "object" + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "GranularCopyLogDetails": { + "description": "Granular Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "DataBoxCustomerDiskCopyProgress": { + "description": "DataBox CustomerDisk Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + } + } + }, + "GranularCopyProgress": { + "description": "Granular Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataBoxCustomerDiskJobDetails": { + "description": "Customer disk job details.", + "required": [ + "jobDetailsType", + "returnToCustomerPackageDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "importDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for import jobs.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ImportDiskDetails" + } + }, + "exportDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for export jobs.", + "type": "object", + "readOnly": true, + "additionalProperties": { + "$ref": "#/definitions/ExportDiskDetails" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxCustomerDiskCopyProgress" + }, + "readOnly": true + }, + "deliverToDcPackageDetails": { + "description": "Delivery package shipping details.", + "$ref": "#/definitions/PackageCarrierInfo", + "readOnly": true + }, + "returnToCustomerPackageDetails": { + "description": "Return package shipping details.", + "$ref": "#/definitions/PackageCarrierDetails" + }, + "enableManifestBackup": { + "description": "Flag to indicate if disk manifest should be backed-up in the Storage Account.", + "type": "boolean", + "default": false + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "CustomerDiskJobSecrets": { + "description": "The secrets related to customer disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "carrierAccountNumber": { + "description": "Carrier Account Number of the customer", + "type": "string", + "readOnly": true, + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DatacenterAddressInstructionResponse": { + "description": "Datacenter instruction for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "communicationInstruction": { + "description": "Data center communication instruction", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressInstruction" + }, + "DatacenterAddressLocationResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "contactPersonName": { + "description": "Contact person name", + "type": "string", + "readOnly": true + }, + "company": { + "description": "Company name", + "type": "string", + "readOnly": true + }, + "street1": { + "description": "Street address line 1", + "type": "string", + "readOnly": true + }, + "street2": { + "description": "Street address line 2", + "type": "string", + "readOnly": true + }, + "street3": { + "description": "Street address line 3", + "type": "string", + "readOnly": true + }, + "city": { + "description": "City name", + "type": "string", + "readOnly": true + }, + "state": { + "description": "name of the state", + "type": "string", + "readOnly": true + }, + "zip": { + "description": "Zip code", + "type": "string", + "readOnly": true + }, + "country": { + "description": "name of the country", + "type": "string", + "readOnly": true + }, + "phone": { + "description": "Phone number", + "type": "string", + "readOnly": true + }, + "phoneExtension": { + "description": "Phone extension", + "type": "string", + "readOnly": true + }, + "addressType": { + "description": "Address type", + "type": "string", + "readOnly": true + }, + "additionalShippingInformation": { + "description": "Special instruction for shipping", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressLocation" + }, + "DatacenterAddressRequest": { + "description": "Request body to get the datacenter address.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the data center address requested.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "DatacenterAddressResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "properties": { + "datacenterAddressType": { + "description": "Data center address type", + "enum": [ + "DatacenterAddressLocation", + "DatacenterAddressInstruction" + ], + "type": "string", + "x-ms-enum": { + "name": "DatacenterAddressType", + "modelAsExtensible": false, + "values": [ + { + "value": "DatacenterAddressLocation", + "description": "Data center address location." + }, + { + "value": "DatacenterAddressInstruction", + "description": "Data center address instruction." + } + ] + } + }, + "supportedCarriersForReturnShipment": { + "description": "List of supported carriers for return shipment.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "dataCenterAzureLocation": { + "description": "Azure Location where the Data Center serves primarily.", + "type": "string", + "readOnly": true + } + }, + "discriminator": "datacenterAddressType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxCustomerDiskCopyLogDetails": { + "description": "Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskGranularCopyLogDetails": { + "description": "Granular Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "accountId": { + "description": "Account id.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskGranularCopyProgress": { + "description": "DataBox Disk Granular Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "granularCopyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyProgress" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account id.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "ExportDiskDetails": { + "description": "Export disk details", + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "ImportDiskDetails": { + "description": "Import disk details", + "required": [ + "manifestFile", + "manifestHash", + "bitLockerKey" + ], + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string" + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string" + }, + "bitLockerKey": { + "description": "BitLocker key used to encrypt the disk.", + "type": "string", + "x-ms-secret": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + }, + "datacenterAddress": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address to ship to, for the given sku and storage location.", + "readOnly": true + }, + "dataCenterCode": { + "description": "DataCenter code.", + "enum": [ + "Invalid", + "BY2", + "BY1", + "ORK70", + "AM2", + "AMS20", + "BY21", + "BY24", + "MWH01", + "AMS06", + "SSE90", + "SYD03", + "SYD23", + "CBR20", + "YTO20", + "CWL20", + "LON24", + "BOM01", + "BL20", + "BL7", + "SEL20", + "TYO01", + "BN1", + "SN5", + "CYS04", + "TYO22", + "YTO21", + "YQB20", + "FRA22", + "MAA01", + "CPQ02", + "CPQ20", + "SIN20", + "HKG20", + "SG2", + "MEL23", + "SEL21", + "OSA20", + "SHA03", + "BJB", + "JNB22", + "JNB21", + "MNZ21", + "SN8", + "AUH20", + "ZRH20", + "PUS20", + "AdHoc", + "CH1", + "DSM05", + "DUB07", + "PNQ01", + "SVG20", + "OSA02", + "OSA22", + "PAR22", + "BN7", + "SN6", + "BJS20" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataCenterCode", + "modelAsString": true, + "values": [ + { + "value": "Invalid" + }, + { + "value": "BY2" + }, + { + "value": "BY1" + }, + { + "value": "ORK70" + }, + { + "value": "AM2" + }, + { + "value": "AMS20" + }, + { + "value": "BY21" + }, + { + "value": "BY24" + }, + { + "value": "MWH01" + }, + { + "value": "AMS06" + }, + { + "value": "SSE90" + }, + { + "value": "SYD03" + }, + { + "value": "SYD23" + }, + { + "value": "CBR20" + }, + { + "value": "YTO20" + }, + { + "value": "CWL20" + }, + { + "value": "LON24" + }, + { + "value": "BOM01" + }, + { + "value": "BL20" + }, + { + "value": "BL7" + }, + { + "value": "SEL20" + }, + { + "value": "TYO01" + }, + { + "value": "BN1" + }, + { + "value": "SN5" + }, + { + "value": "CYS04" + }, + { + "value": "TYO22" + }, + { + "value": "YTO21" + }, + { + "value": "YQB20" + }, + { + "value": "FRA22" + }, + { + "value": "MAA01" + }, + { + "value": "CPQ02" + }, + { + "value": "CPQ20" + }, + { + "value": "SIN20" + }, + { + "value": "HKG20" + }, + { + "value": "SG2" + }, + { + "value": "MEL23" + }, + { + "value": "SEL21" + }, + { + "value": "OSA20" + }, + { + "value": "SHA03" + }, + { + "value": "BJB" + }, + { + "value": "JNB22" + }, + { + "value": "JNB21" + }, + { + "value": "MNZ21" + }, + { + "value": "SN8" + }, + { + "value": "AUH20" + }, + { + "value": "ZRH20" + }, + { + "value": "PUS20" + }, + { + "value": "AdHoc" + }, + { + "value": "CH1" + }, + { + "value": "DSM05" + }, + { + "value": "DUB07" + }, + { + "value": "PNQ01" + }, + { + "value": "SVG20" + }, + { + "value": "OSA02" + }, + { + "value": "OSA22" + }, + { + "value": "PAR22" + }, + { + "value": "BN7" + }, + { + "value": "SN6" + }, + { + "value": "BJS20" + } + ] + } + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "MarkDevicesShippedRequest": { + "description": "The request body to provide the delivery package details of job", + "required": [ + "deliverToDcPackageDetails" + ], + "type": "object", + "properties": { + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package details" + } + } + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "required": [ + "customerResolutionCode" + ], + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Created", + "ShippedToCustomer" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsString": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + }, + { + "value": "Created", + "description": "Notification at job created stage." + }, + { + "value": "ShippedToCustomer", + "description": "Notification at shipped devices to customer stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageCarrierDetails": { + "description": "Package carrier details.", + "type": "object", + "properties": { + "carrierAccountNumber": { + "description": "Carrier Account Number of customer for customer disk.", + "type": "string", + "x-ms-secret": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageCarrierInfo": { + "description": "package carrier info", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageShippingDetails": { + "description": "package shipping details", + "type": "object", + "properties": { + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + }, + "storageAccountAccessTierPreferences": { + "description": "Preferences related to the Access Tier of storage accounts.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "Archive" + ], + "type": "string", + "x-ms-enum": { + "name": "StorageAccountAccessTier", + "modelAsExtensible": true, + "values": [ + { + "value": "Archive", + "description": "Archive Access Tier shares requested by the customer." + } + ] + } + } + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + }, + "datacenterAddressRequest": { + "$ref": "#/definitions/DatacenterAddressRequest", + "description": "Request body to get the datacenter address for given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + }, + "datacenterAddressResponse": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address for given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package details of job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-02-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-02-01/databox.json new file mode 100644 index 00000000000..bdf7ed5e08f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-02-01/databox.json @@ -0,0 +1,6527 @@ +{ + "swagger": "2.0", + "info": { + "version": "2022-02-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mark devices for a given job as shipped", + "operationId": "Jobs_MarkDevicesShipped", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "markDevicesShippedRequest", + "in": "body", + "description": "Mark Devices Shipped Request", + "required": true, + "schema": { + "$ref": "#/definitions/MarkDevicesShippedRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "MarkDevicesShipped": { + "$ref": "./examples/MarkDevicesShipped.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + }, + "JobsGetWaitingForAction": { + "$ref": "./examples/JobsGetWaitingForAction.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job." + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "description": "This class represents additional info which Resource Providers pass when an error occurs.", + "properties": { + "info": { + "description": "Additional information of the type of error.", + "type": "object" + }, + "type": { + "description": "Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation).", + "type": "string" + } + }, + "type": "object" + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Provides additional information about an http error response.", + "properties": { + "additionalInfo": { + "description": "Gets or sets additional error info.", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true, + "type": "array" + }, + "code": { + "description": "Error code.", + "type": "string" + }, + "details": { + "description": "Gets or sets details for the error.", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true, + "type": "array" + }, + "message": { + "description": "The error message parsed from the body of the http error response.", + "type": "string" + }, + "target": { + "description": "Gets or sets the target of the error.", + "type": "string" + } + }, + "type": "object" + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "GranularCopyLogDetails": { + "description": "Granular Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "DataBoxCustomerDiskCopyProgress": { + "description": "DataBox CustomerDisk Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DeviceErasureDetails": { + "description": "Device erasure details with erasure completion status and erasureordestructionlog sas key", + "type": "object", + "properties": { + "deviceErasureStatus": { + "description": "Holds the device erasure completion status", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action for clean up." + } + ] + } + }, + "erasureOrDestructionCertificateSasKey": { + "description": "Shared access key to download cleanup or destruction certificate for device", + "type": "string", + "readOnly": true + } + } + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + } + } + }, + "GranularCopyProgress": { + "description": "Granular Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataBoxCustomerDiskJobDetails": { + "description": "Customer disk job details.", + "required": [ + "jobDetailsType", + "returnToCustomerPackageDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "importDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for import jobs.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ImportDiskDetails" + } + }, + "exportDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for export jobs.", + "type": "object", + "readOnly": true, + "additionalProperties": { + "$ref": "#/definitions/ExportDiskDetails" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxCustomerDiskCopyProgress" + }, + "readOnly": true + }, + "deliverToDcPackageDetails": { + "description": "Delivery package shipping details.", + "$ref": "#/definitions/PackageCarrierInfo", + "readOnly": true + }, + "returnToCustomerPackageDetails": { + "description": "Return package shipping details.", + "$ref": "#/definitions/PackageCarrierDetails" + }, + "enableManifestBackup": { + "description": "Flag to indicate if disk manifest should be backed-up in the Storage Account.", + "type": "boolean", + "default": false + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "CustomerDiskJobSecrets": { + "description": "The secrets related to customer disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "carrierAccountNumber": { + "description": "Carrier Account Number of the customer", + "type": "string", + "readOnly": true, + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DatacenterAddressInstructionResponse": { + "description": "Datacenter instruction for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "communicationInstruction": { + "description": "Data center communication instruction", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressInstruction" + }, + "DatacenterAddressLocationResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "contactPersonName": { + "description": "Contact person name", + "type": "string", + "readOnly": true + }, + "company": { + "description": "Company name", + "type": "string", + "readOnly": true + }, + "street1": { + "description": "Street address line 1", + "type": "string", + "readOnly": true + }, + "street2": { + "description": "Street address line 2", + "type": "string", + "readOnly": true + }, + "street3": { + "description": "Street address line 3", + "type": "string", + "readOnly": true + }, + "city": { + "description": "City name", + "type": "string", + "readOnly": true + }, + "state": { + "description": "name of the state", + "type": "string", + "readOnly": true + }, + "zip": { + "description": "Zip code", + "type": "string", + "readOnly": true + }, + "country": { + "description": "name of the country", + "type": "string", + "readOnly": true + }, + "phone": { + "description": "Phone number", + "type": "string", + "readOnly": true + }, + "phoneExtension": { + "description": "Phone extension", + "type": "string", + "readOnly": true + }, + "addressType": { + "description": "Address type", + "type": "string", + "readOnly": true + }, + "additionalShippingInformation": { + "description": "Special instruction for shipping", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressLocation" + }, + "DatacenterAddressRequest": { + "description": "Request body to get the datacenter address.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the data center address requested.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "DatacenterAddressResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "properties": { + "datacenterAddressType": { + "description": "Data center address type", + "enum": [ + "DatacenterAddressLocation", + "DatacenterAddressInstruction" + ], + "type": "string", + "x-ms-enum": { + "name": "DatacenterAddressType", + "modelAsExtensible": false, + "values": [ + { + "value": "DatacenterAddressLocation", + "description": "Data center address location." + }, + { + "value": "DatacenterAddressInstruction", + "description": "Data center address instruction." + } + ] + } + }, + "supportedCarriersForReturnShipment": { + "description": "List of supported carriers for return shipment.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "dataCenterAzureLocation": { + "description": "Azure Location where the Data Center serves primarily.", + "type": "string", + "readOnly": true + } + }, + "discriminator": "datacenterAddressType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxCustomerDiskCopyLogDetails": { + "description": "Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskGranularCopyLogDetails": { + "description": "Granular Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "accountId": { + "description": "Account id.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskGranularCopyProgress": { + "description": "DataBox Disk Granular Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "granularCopyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyProgress" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "granularCopyLogDetails": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyLogDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "ExportDiskDetails": { + "description": "Export disk details", + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "ImportDiskDetails": { + "description": "Import disk details", + "required": [ + "manifestFile", + "manifestHash", + "bitLockerKey" + ], + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string" + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string" + }, + "bitLockerKey": { + "description": "BitLocker key used to encrypt the disk.", + "type": "string", + "x-ms-secret": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "deviceErasureDetails": { + "$ref": "#/definitions/DeviceErasureDetails", + "description": "Holds device data erasure details", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + }, + "datacenterAddress": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address to ship to, for the given sku and storage location.", + "readOnly": true + }, + "dataCenterCode": { + "description": "DataCenter code.", + "enum": [ + "Invalid", + "BY2", + "BY1", + "ORK70", + "AM2", + "AMS20", + "BY21", + "BY24", + "MWH01", + "AMS06", + "SSE90", + "SYD03", + "SYD23", + "CBR20", + "YTO20", + "CWL20", + "LON24", + "BOM01", + "BL20", + "BL7", + "SEL20", + "TYO01", + "BN1", + "SN5", + "CYS04", + "TYO22", + "YTO21", + "YQB20", + "FRA22", + "MAA01", + "CPQ02", + "CPQ20", + "SIN20", + "HKG20", + "SG2", + "MEL23", + "SEL21", + "OSA20", + "SHA03", + "BJB", + "JNB22", + "JNB21", + "MNZ21", + "SN8", + "AUH20", + "ZRH20", + "PUS20", + "AdHoc", + "CH1", + "DSM05", + "DUB07", + "PNQ01", + "SVG20", + "OSA02", + "OSA22", + "PAR22", + "BN7", + "SN6", + "BJS20" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataCenterCode", + "modelAsString": true, + "values": [ + { + "value": "Invalid" + }, + { + "value": "BY2" + }, + { + "value": "BY1" + }, + { + "value": "ORK70" + }, + { + "value": "AM2" + }, + { + "value": "AMS20" + }, + { + "value": "BY21" + }, + { + "value": "BY24" + }, + { + "value": "MWH01" + }, + { + "value": "AMS06" + }, + { + "value": "SSE90" + }, + { + "value": "SYD03" + }, + { + "value": "SYD23" + }, + { + "value": "CBR20" + }, + { + "value": "YTO20" + }, + { + "value": "CWL20" + }, + { + "value": "LON24" + }, + { + "value": "BOM01" + }, + { + "value": "BL20" + }, + { + "value": "BL7" + }, + { + "value": "SEL20" + }, + { + "value": "TYO01" + }, + { + "value": "BN1" + }, + { + "value": "SN5" + }, + { + "value": "CYS04" + }, + { + "value": "TYO22" + }, + { + "value": "YTO21" + }, + { + "value": "YQB20" + }, + { + "value": "FRA22" + }, + { + "value": "MAA01" + }, + { + "value": "CPQ02" + }, + { + "value": "CPQ20" + }, + { + "value": "SIN20" + }, + { + "value": "HKG20" + }, + { + "value": "SG2" + }, + { + "value": "MEL23" + }, + { + "value": "SEL21" + }, + { + "value": "OSA20" + }, + { + "value": "SHA03" + }, + { + "value": "BJB" + }, + { + "value": "JNB22" + }, + { + "value": "JNB21" + }, + { + "value": "MNZ21" + }, + { + "value": "SN8" + }, + { + "value": "AUH20" + }, + { + "value": "ZRH20" + }, + { + "value": "PUS20" + }, + { + "value": "AdHoc" + }, + { + "value": "CH1" + }, + { + "value": "DSM05" + }, + { + "value": "DUB07" + }, + { + "value": "PNQ01" + }, + { + "value": "SVG20" + }, + { + "value": "OSA02" + }, + { + "value": "OSA22" + }, + { + "value": "PAR22" + }, + { + "value": "BN7" + }, + { + "value": "SN6" + }, + { + "value": "BJS20" + } + ] + } + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "MarkDevicesShippedRequest": { + "description": "The request body to provide the delivery package details of job", + "required": [ + "deliverToDcPackageDetails" + ], + "type": "object", + "properties": { + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package details" + } + } + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "required": [ + "customerResolutionCode" + ], + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Created", + "ShippedToCustomer" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsString": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + }, + { + "value": "Created", + "description": "Notification at job created stage." + }, + { + "value": "ShippedToCustomer", + "description": "Notification at shipped devices to customer stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageCarrierDetails": { + "description": "Package carrier details.", + "type": "object", + "properties": { + "carrierAccountNumber": { + "description": "Carrier Account Number of customer for customer disk.", + "type": "string", + "x-ms-secret": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageCarrierInfo": { + "description": "package carrier info", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageShippingDetails": { + "description": "package shipping details", + "type": "object", + "properties": { + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + }, + "storageAccountAccessTierPreferences": { + "description": "Preferences related to the Access Tier of storage accounts.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "Archive" + ], + "type": "string", + "x-ms-enum": { + "name": "StorageAccountAccessTier", + "modelAsExtensible": true, + "values": [ + { + "value": "Archive", + "description": "Archive Access Tier shares requested by the customer." + } + ] + } + } + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + }, + "datacenterAddressRequest": { + "$ref": "#/definitions/DatacenterAddressRequest", + "description": "Request body to get the datacenter address for given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + }, + "datacenterAddressResponse": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address for given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package details of job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-09-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-09-01/databox.json new file mode 100644 index 00000000000..0848343d26d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-09-01/databox.json @@ -0,0 +1,6667 @@ +{ + "swagger": "2.0", + "info": { + "version": "2022-09-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mark devices for a given job as shipped", + "operationId": "Jobs_MarkDevicesShipped", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "markDevicesShippedRequest", + "in": "body", + "description": "Mark Devices Shipped Request", + "required": true, + "schema": { + "$ref": "#/definitions/MarkDevicesShippedRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "MarkDevicesShipped": { + "$ref": "./examples/MarkDevicesShipped.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + }, + "JobsGetWaitingForAction": { + "$ref": "./examples/JobsGetWaitingForAction.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "description": "This class represents additional info which Resource Providers pass when an error occurs.", + "properties": { + "info": { + "description": "Additional information of the type of error.", + "type": "object" + }, + "type": { + "description": "Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation).", + "type": "string" + } + }, + "type": "object" + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Provides additional information about an http error response.", + "properties": { + "additionalInfo": { + "description": "Gets or sets additional error info.", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true, + "type": "array" + }, + "code": { + "description": "Error code.", + "type": "string" + }, + "details": { + "description": "Gets or sets details for the error.", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true, + "type": "array" + }, + "message": { + "description": "The error message parsed from the body of the http error response.", + "type": "string" + }, + "target": { + "description": "Gets or sets the target of the error.", + "type": "string" + } + }, + "type": "object" + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "ContactInfo": { + "description": "Contact Info.", + "required": [ + "contactName", + "phone" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "minLength": 1, + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "minLength": 1, + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "GranularCopyLogDetails": { + "description": "Granular Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "DataBoxCustomerDiskCopyProgress": { + "description": "DataBox CustomerDisk Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DeviceErasureDetails": { + "description": "Device erasure details with erasure completion status and erasureordestructionlog sas key", + "type": "object", + "properties": { + "deviceErasureStatus": { + "description": "Holds the device erasure completion status", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action for clean up." + } + ] + } + }, + "erasureOrDestructionCertificateSasKey": { + "description": "Shared access key to download cleanup or destruction certificate for device", + "type": "string", + "readOnly": true + } + } + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + } + } + }, + "GranularCopyProgress": { + "description": "Granular Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataBoxCustomerDiskJobDetails": { + "description": "Customer disk job details.", + "required": [ + "jobDetailsType", + "returnToCustomerPackageDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "importDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for import jobs.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ImportDiskDetails" + } + }, + "exportDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for export jobs.", + "type": "object", + "readOnly": true, + "additionalProperties": { + "$ref": "#/definitions/ExportDiskDetails" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxCustomerDiskCopyProgress" + }, + "readOnly": true + }, + "deliverToDcPackageDetails": { + "description": "Delivery package shipping details.", + "$ref": "#/definitions/PackageCarrierInfo", + "readOnly": true + }, + "returnToCustomerPackageDetails": { + "description": "Return package shipping details.", + "$ref": "#/definitions/PackageCarrierDetails" + }, + "enableManifestBackup": { + "description": "Flag to indicate if disk manifest should be backed-up in the Storage Account.", + "type": "boolean", + "default": false + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "CustomerDiskJobSecrets": { + "description": "The secrets related to customer disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "carrierAccountNumber": { + "description": "Carrier Account Number of the customer", + "type": "string", + "readOnly": true, + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DatacenterAddressInstructionResponse": { + "description": "Datacenter instruction for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "communicationInstruction": { + "description": "Data center communication instruction", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressInstruction" + }, + "DatacenterAddressLocationResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "contactPersonName": { + "description": "Contact person name", + "type": "string", + "readOnly": true + }, + "company": { + "description": "Company name", + "type": "string", + "readOnly": true + }, + "street1": { + "description": "Street address line 1", + "type": "string", + "readOnly": true + }, + "street2": { + "description": "Street address line 2", + "type": "string", + "readOnly": true + }, + "street3": { + "description": "Street address line 3", + "type": "string", + "readOnly": true + }, + "city": { + "description": "City name", + "type": "string", + "readOnly": true + }, + "state": { + "description": "name of the state", + "type": "string", + "readOnly": true + }, + "zip": { + "description": "Zip code", + "type": "string", + "readOnly": true + }, + "country": { + "description": "name of the country", + "type": "string", + "readOnly": true + }, + "phone": { + "description": "Phone number", + "type": "string", + "readOnly": true + }, + "phoneExtension": { + "description": "Phone extension", + "type": "string", + "readOnly": true + }, + "addressType": { + "description": "Address type", + "type": "string", + "readOnly": true + }, + "additionalShippingInformation": { + "description": "Special instruction for shipping", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressLocation" + }, + "DatacenterAddressRequest": { + "description": "Request body to get the datacenter address.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the data center address requested.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "DatacenterAddressResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "properties": { + "datacenterAddressType": { + "description": "Data center address type", + "enum": [ + "DatacenterAddressLocation", + "DatacenterAddressInstruction" + ], + "type": "string", + "x-ms-enum": { + "name": "DatacenterAddressType", + "modelAsExtensible": false, + "values": [ + { + "value": "DatacenterAddressLocation", + "description": "Data center address location." + }, + { + "value": "DatacenterAddressInstruction", + "description": "Data center address instruction." + } + ] + } + }, + "supportedCarriersForReturnShipment": { + "description": "List of supported carriers for return shipment.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "dataCenterAzureLocation": { + "description": "Azure Location where the Data Center serves primarily.", + "type": "string", + "readOnly": true + } + }, + "discriminator": "datacenterAddressType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxCustomerDiskCopyLogDetails": { + "description": "Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskGranularCopyLogDetails": { + "description": "Granular Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "accountId": { + "description": "Account id.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskGranularCopyProgress": { + "description": "DataBox Disk Granular Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "granularCopyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyProgress" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "granularCopyLogDetails": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyLogDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "ExportDiskDetails": { + "description": "Export disk details", + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "ImportDiskDetails": { + "description": "Import disk details", + "required": [ + "manifestFile", + "manifestHash", + "bitLockerKey" + ], + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string" + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string" + }, + "bitLockerKey": { + "description": "BitLocker key used to encrypt the disk.", + "type": "string", + "x-ms-secret": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails", + "description": "Optional Reverse Shipping details for order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "deviceErasureDetails": { + "$ref": "#/definitions/DeviceErasureDetails", + "description": "Holds device data erasure details", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + }, + "datacenterAddress": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address to ship to, for the given sku and storage location.", + "readOnly": true + }, + "dataCenterCode": { + "description": "DataCenter code.", + "enum": [ + "Invalid", + "BY2", + "BY1", + "ORK70", + "AM2", + "AMS20", + "BY21", + "BY24", + "MWH01", + "AMS06", + "SSE90", + "SYD03", + "SYD23", + "CBR20", + "YTO20", + "CWL20", + "LON24", + "BOM01", + "BL20", + "BL7", + "SEL20", + "TYO01", + "BN1", + "SN5", + "CYS04", + "TYO22", + "YTO21", + "YQB20", + "FRA22", + "MAA01", + "CPQ02", + "CPQ20", + "SIN20", + "HKG20", + "SG2", + "MEL23", + "SEL21", + "OSA20", + "SHA03", + "BJB", + "JNB22", + "JNB21", + "MNZ21", + "SN8", + "AUH20", + "ZRH20", + "PUS20", + "AdHoc", + "CH1", + "DSM05", + "DUB07", + "PNQ01", + "SVG20", + "OSA02", + "OSA22", + "PAR22", + "BN7", + "SN6", + "BJS20" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataCenterCode", + "modelAsString": true, + "values": [ + { + "value": "Invalid" + }, + { + "value": "BY2" + }, + { + "value": "BY1" + }, + { + "value": "ORK70" + }, + { + "value": "AM2" + }, + { + "value": "AMS20" + }, + { + "value": "BY21" + }, + { + "value": "BY24" + }, + { + "value": "MWH01" + }, + { + "value": "AMS06" + }, + { + "value": "SSE90" + }, + { + "value": "SYD03" + }, + { + "value": "SYD23" + }, + { + "value": "CBR20" + }, + { + "value": "YTO20" + }, + { + "value": "CWL20" + }, + { + "value": "LON24" + }, + { + "value": "BOM01" + }, + { + "value": "BL20" + }, + { + "value": "BL7" + }, + { + "value": "SEL20" + }, + { + "value": "TYO01" + }, + { + "value": "BN1" + }, + { + "value": "SN5" + }, + { + "value": "CYS04" + }, + { + "value": "TYO22" + }, + { + "value": "YTO21" + }, + { + "value": "YQB20" + }, + { + "value": "FRA22" + }, + { + "value": "MAA01" + }, + { + "value": "CPQ02" + }, + { + "value": "CPQ20" + }, + { + "value": "SIN20" + }, + { + "value": "HKG20" + }, + { + "value": "SG2" + }, + { + "value": "MEL23" + }, + { + "value": "SEL21" + }, + { + "value": "OSA20" + }, + { + "value": "SHA03" + }, + { + "value": "BJB" + }, + { + "value": "JNB22" + }, + { + "value": "JNB21" + }, + { + "value": "MNZ21" + }, + { + "value": "SN8" + }, + { + "value": "AUH20" + }, + { + "value": "ZRH20" + }, + { + "value": "PUS20" + }, + { + "value": "AdHoc" + }, + { + "value": "CH1" + }, + { + "value": "DSM05" + }, + { + "value": "DUB07" + }, + { + "value": "PNQ01" + }, + { + "value": "SVG20" + }, + { + "value": "OSA02" + }, + { + "value": "OSA22" + }, + { + "value": "PAR22" + }, + { + "value": "BN7" + }, + { + "value": "SN6" + }, + { + "value": "BJS20" + } + ] + } + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "reverseShippingDetailsUpdate": { + "description": "The Editable status for Reverse Shipping Address and Contact Info", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseShippingDetailsEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse shipping details can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse shipping details." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse shipping details. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "reverseTransportPreferenceUpdate": { + "description": "The Editable status for Reverse Transport preferences", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseTransportPreferenceEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse Transport Preferences can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse Transport Preferences." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse Transport Preferences. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "MarkDevicesShippedRequest": { + "description": "The request body to provide the delivery package details of job", + "required": [ + "deliverToDcPackageDetails" + ], + "type": "object", + "properties": { + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package details" + } + } + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "required": [ + "customerResolutionCode" + ], + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Created", + "ShippedToCustomer" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsString": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + }, + { + "value": "Created", + "description": "Notification at job created stage." + }, + { + "value": "ShippedToCustomer", + "description": "Notification at shipped devices to customer stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageCarrierDetails": { + "description": "Package carrier details.", + "type": "object", + "properties": { + "carrierAccountNumber": { + "description": "Carrier Account Number of customer for customer disk.", + "type": "string", + "x-ms-secret": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageCarrierInfo": { + "description": "package carrier info", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageShippingDetails": { + "description": "package shipping details", + "type": "object", + "properties": { + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "reverseTransportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Optional Preferences related to the reverse shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + }, + "storageAccountAccessTierPreferences": { + "description": "Preferences related to the Access Tier of storage accounts.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "Archive" + ], + "type": "string", + "x-ms-enum": { + "name": "StorageAccountAccessTier", + "modelAsExtensible": true, + "values": [ + { + "value": "Archive", + "description": "Archive Access Tier shares requested by the customer." + } + ] + } + } + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + }, + "datacenterAddressRequest": { + "$ref": "#/definitions/DatacenterAddressRequest", + "description": "Request body to get the datacenter address for given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + }, + "datacenterAddressResponse": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address for given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ReverseShippingDetails": { + "description": "Reverse Shipping Address and contact details for a job.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactInfo" + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress" + }, + "isUpdated": { + "description": "A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared.\r\nRead only field", + "type": "boolean", + "readOnly": true + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + }, + "countriesWithinCommerceBoundary": { + "description": "List of all the Countries in the SKU specific commerce boundary", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + }, + "isUpdated": { + "description": "Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + "type": "boolean", + "readOnly": true + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails" + }, + "preferences": { + "$ref": "#/definitions/Preferences" + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package details of job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-10-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-10-01/databox.json new file mode 100644 index 00000000000..243ffecac3b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-10-01/databox.json @@ -0,0 +1,6800 @@ +{ + "swagger": "2.0", + "info": { + "version": "2022-10-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mark devices for a given job as shipped", + "operationId": "Jobs_MarkDevicesShipped", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "markDevicesShippedRequest", + "in": "body", + "description": "Mark Devices Shipped Request", + "required": true, + "schema": { + "$ref": "#/definitions/MarkDevicesShippedRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "MarkDevicesShipped": { + "$ref": "./examples/MarkDevicesShipped.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + }, + "JobsGetWaitingForAction": { + "$ref": "./examples/JobsGetWaitingForAction.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "description": "This class represents additional info which Resource Providers pass when an error occurs.", + "properties": { + "info": { + "description": "Additional information of the type of error.", + "type": "object" + }, + "type": { + "description": "Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation).", + "type": "string" + } + }, + "type": "object" + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Provides additional information about an http error response.", + "properties": { + "additionalInfo": { + "description": "Gets or sets additional error info.", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true, + "type": "array" + }, + "code": { + "description": "Error code.", + "type": "string" + }, + "details": { + "description": "Gets or sets details for the error.", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true, + "type": "array" + }, + "message": { + "description": "The error message parsed from the body of the http error response.", + "type": "string" + }, + "target": { + "description": "Gets or sets the target of the error.", + "type": "string" + } + }, + "type": "object" + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "ContactInfo": { + "description": "Contact Info.", + "required": [ + "contactName", + "phone" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "minLength": 1, + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "minLength": 1, + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "GranularCopyLogDetails": { + "description": "Granular Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "DataBoxCustomerDiskCopyProgress": { + "description": "DataBox CustomerDisk Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DeviceErasureDetails": { + "description": "Device erasure details with erasure completion status and erasureordestructionlog sas key", + "type": "object", + "properties": { + "deviceErasureStatus": { + "description": "Holds the device erasure completion status", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action for clean up." + } + ] + } + }, + "erasureOrDestructionCertificateSasKey": { + "description": "Shared access key to download cleanup or destruction certificate for device", + "type": "string", + "readOnly": true + } + } + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + } + } + }, + "GranularCopyProgress": { + "description": "Granular Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataBoxCustomerDiskJobDetails": { + "description": "Customer disk job details.", + "required": [ + "jobDetailsType", + "returnToCustomerPackageDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "importDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for import jobs.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ImportDiskDetails" + } + }, + "exportDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for export jobs.", + "type": "object", + "readOnly": true, + "additionalProperties": { + "$ref": "#/definitions/ExportDiskDetails" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxCustomerDiskCopyProgress" + }, + "readOnly": true + }, + "deliverToDcPackageDetails": { + "description": "Delivery package shipping details.", + "$ref": "#/definitions/PackageCarrierInfo", + "readOnly": true + }, + "returnToCustomerPackageDetails": { + "description": "Return package shipping details.", + "$ref": "#/definitions/PackageCarrierDetails" + }, + "enableManifestBackup": { + "description": "Flag to indicate if disk manifest should be backed-up in the Storage Account.", + "type": "boolean", + "default": false + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "CustomerDiskJobSecrets": { + "description": "The secrets related to customer disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "carrierAccountNumber": { + "description": "Carrier Account Number of the customer", + "type": "string", + "readOnly": true, + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DatacenterAddressInstructionResponse": { + "description": "Datacenter instruction for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "communicationInstruction": { + "description": "Data center communication instruction", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressInstruction" + }, + "DatacenterAddressLocationResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "contactPersonName": { + "description": "Contact person name", + "type": "string", + "readOnly": true + }, + "company": { + "description": "Company name", + "type": "string", + "readOnly": true + }, + "street1": { + "description": "Street address line 1", + "type": "string", + "readOnly": true + }, + "street2": { + "description": "Street address line 2", + "type": "string", + "readOnly": true + }, + "street3": { + "description": "Street address line 3", + "type": "string", + "readOnly": true + }, + "city": { + "description": "City name", + "type": "string", + "readOnly": true + }, + "state": { + "description": "name of the state", + "type": "string", + "readOnly": true + }, + "zip": { + "description": "Zip code", + "type": "string", + "readOnly": true + }, + "country": { + "description": "name of the country", + "type": "string", + "readOnly": true + }, + "phone": { + "description": "Phone number", + "type": "string", + "readOnly": true + }, + "phoneExtension": { + "description": "Phone extension", + "type": "string", + "readOnly": true + }, + "addressType": { + "description": "Address type", + "type": "string", + "readOnly": true + }, + "additionalShippingInformation": { + "description": "Special instruction for shipping", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressLocation" + }, + "DatacenterAddressRequest": { + "description": "Request body to get the datacenter address.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the data center address requested.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "DatacenterAddressResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "properties": { + "datacenterAddressType": { + "description": "Data center address type", + "enum": [ + "DatacenterAddressLocation", + "DatacenterAddressInstruction" + ], + "type": "string", + "x-ms-enum": { + "name": "DatacenterAddressType", + "modelAsExtensible": false, + "values": [ + { + "value": "DatacenterAddressLocation", + "description": "Data center address location." + }, + { + "value": "DatacenterAddressInstruction", + "description": "Data center address instruction." + } + ] + } + }, + "supportedCarriersForReturnShipment": { + "description": "List of supported carriers for return shipment.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "dataCenterAzureLocation": { + "description": "Azure Location where the Data Center serves primarily.", + "type": "string", + "readOnly": true + } + }, + "discriminator": "datacenterAddressType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxCustomerDiskCopyLogDetails": { + "description": "Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskGranularCopyLogDetails": { + "description": "Granular Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "accountId": { + "description": "Account id.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "DataBoxDiskGranularCopyProgress": { + "description": "DataBox Disk Granular Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "granularCopyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyProgress" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "granularCopyLogDetails": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyLogDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "ExportDiskDetails": { + "description": "Export disk details", + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "ImportDiskDetails": { + "description": "Import disk details", + "required": [ + "manifestFile", + "manifestHash", + "bitLockerKey" + ], + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string" + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string" + }, + "bitLockerKey": { + "description": "BitLocker key used to encrypt the disk.", + "type": "string", + "x-ms-secret": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails", + "description": "Optional Reverse Shipping details for order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "deviceErasureDetails": { + "$ref": "#/definitions/DeviceErasureDetails", + "description": "Holds device data erasure details", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + }, + "datacenterAddress": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address to ship to, for the given sku and storage location.", + "readOnly": true + }, + "dataCenterCode": { + "description": "DataCenter code.", + "enum": [ + "Invalid", + "BY2", + "BY1", + "ORK70", + "AM2", + "AMS20", + "BY21", + "BY24", + "MWH01", + "AMS06", + "SSE90", + "SYD03", + "SYD23", + "CBR20", + "YTO20", + "CWL20", + "LON24", + "BOM01", + "BL20", + "BL7", + "SEL20", + "TYO01", + "BN1", + "SN5", + "CYS04", + "TYO22", + "YTO21", + "YQB20", + "FRA22", + "MAA01", + "CPQ02", + "CPQ20", + "SIN20", + "HKG20", + "SG2", + "MEL23", + "SEL21", + "OSA20", + "SHA03", + "BJB", + "JNB22", + "JNB21", + "MNZ21", + "SN8", + "AUH20", + "ZRH20", + "PUS20", + "AdHoc", + "CH1", + "DSM05", + "DUB07", + "PNQ01", + "SVG20", + "OSA02", + "OSA22", + "PAR22", + "BN7", + "SN6", + "BJS20" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataCenterCode", + "modelAsString": true, + "values": [ + { + "value": "Invalid" + }, + { + "value": "BY2" + }, + { + "value": "BY1" + }, + { + "value": "ORK70" + }, + { + "value": "AM2" + }, + { + "value": "AMS20" + }, + { + "value": "BY21" + }, + { + "value": "BY24" + }, + { + "value": "MWH01" + }, + { + "value": "AMS06" + }, + { + "value": "SSE90" + }, + { + "value": "SYD03" + }, + { + "value": "SYD23" + }, + { + "value": "CBR20" + }, + { + "value": "YTO20" + }, + { + "value": "CWL20" + }, + { + "value": "LON24" + }, + { + "value": "BOM01" + }, + { + "value": "BL20" + }, + { + "value": "BL7" + }, + { + "value": "SEL20" + }, + { + "value": "TYO01" + }, + { + "value": "BN1" + }, + { + "value": "SN5" + }, + { + "value": "CYS04" + }, + { + "value": "TYO22" + }, + { + "value": "YTO21" + }, + { + "value": "YQB20" + }, + { + "value": "FRA22" + }, + { + "value": "MAA01" + }, + { + "value": "CPQ02" + }, + { + "value": "CPQ20" + }, + { + "value": "SIN20" + }, + { + "value": "HKG20" + }, + { + "value": "SG2" + }, + { + "value": "MEL23" + }, + { + "value": "SEL21" + }, + { + "value": "OSA20" + }, + { + "value": "SHA03" + }, + { + "value": "BJB" + }, + { + "value": "JNB22" + }, + { + "value": "JNB21" + }, + { + "value": "MNZ21" + }, + { + "value": "SN8" + }, + { + "value": "AUH20" + }, + { + "value": "ZRH20" + }, + { + "value": "PUS20" + }, + { + "value": "AdHoc" + }, + { + "value": "CH1" + }, + { + "value": "DSM05" + }, + { + "value": "DUB07" + }, + { + "value": "PNQ01" + }, + { + "value": "SVG20" + }, + { + "value": "OSA02" + }, + { + "value": "OSA22" + }, + { + "value": "PAR22" + }, + { + "value": "BN7" + }, + { + "value": "SN6" + }, + { + "value": "BJS20" + } + ] + } + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "reverseShippingDetailsUpdate": { + "description": "The Editable status for Reverse Shipping Address and Contact Info", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseShippingDetailsEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse shipping details can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse shipping details." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse shipping details. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "reverseTransportPreferenceUpdate": { + "description": "The Editable status for Reverse Transport preferences", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseTransportPreferenceEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse Transport Preferences can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse Transport Preferences." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse Transport Preferences. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "MarkDevicesShippedRequest": { + "description": "The request body to provide the delivery package details of job", + "required": [ + "deliverToDcPackageDetails" + ], + "type": "object", + "properties": { + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package details" + } + } + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "serialNumberCustomerResolutionMap": { + "description": "Serial number and the customer resolution code corresponding to each serial number", + "type": "object", + "additionalProperties": { + "format": "int32", + "description": "Available customer resolution codes on a job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job" + }, + { + "value": "Restart", + "description": "Restart whole action" + }, + { + "value": "ReachOutToOperation", + "description": "Reach out to operation for further action" + } + ] + } + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Created", + "ShippedToCustomer" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsString": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + }, + { + "value": "Created", + "description": "Notification at job created stage." + }, + { + "value": "ShippedToCustomer", + "description": "Notification at shipped devices to customer stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageCarrierDetails": { + "description": "Package carrier details.", + "type": "object", + "properties": { + "carrierAccountNumber": { + "description": "Carrier Account Number of customer for customer disk.", + "type": "string", + "x-ms-secret": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageCarrierInfo": { + "description": "package carrier info", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageShippingDetails": { + "description": "package shipping details", + "type": "object", + "properties": { + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "reverseTransportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Optional Preferences related to the reverse shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + }, + "storageAccountAccessTierPreferences": { + "description": "Preferences related to the Access Tier of storage accounts.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "Archive" + ], + "type": "string", + "x-ms-enum": { + "name": "StorageAccountAccessTier", + "modelAsExtensible": true, + "values": [ + { + "value": "Archive", + "description": "Archive Access Tier shares requested by the customer." + } + ] + } + } + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + }, + "datacenterAddressRequest": { + "$ref": "#/definitions/DatacenterAddressRequest", + "description": "Request body to get the datacenter address for given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + }, + "datacenterAddressResponse": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address for given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ReverseShippingDetails": { + "description": "Reverse Shipping Address and contact details for a job.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactInfo" + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress" + }, + "isUpdated": { + "description": "A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared.\r\nRead only field", + "type": "boolean", + "readOnly": true + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + }, + "countriesWithinCommerceBoundary": { + "description": "List of all the Countries in the SKU specific commerce boundary", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + }, + "isUpdated": { + "description": "Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + "type": "boolean", + "readOnly": true + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails" + }, + "preferences": { + "$ref": "#/definitions/Preferences" + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package details of job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-12-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-12-01/databox.json new file mode 100644 index 00000000000..ca91e8aa368 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2022-12-01/databox.json @@ -0,0 +1,6877 @@ +{ + "swagger": "2.0", + "info": { + "version": "2022-12-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mark devices for a given job as shipped", + "operationId": "Jobs_MarkDevicesShipped", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "markDevicesShippedRequest", + "in": "body", + "description": "Mark Devices Shipped Request", + "required": true, + "schema": { + "$ref": "#/definitions/MarkDevicesShippedRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "MarkDevicesShipped": { + "$ref": "./examples/MarkDevicesShipped.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + }, + "JobsGetWaitingForAction": { + "$ref": "./examples/JobsGetWaitingForAction.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "description": "This class represents additional info which Resource Providers pass when an error occurs.", + "properties": { + "info": { + "description": "Additional information of the type of error.", + "type": "object" + }, + "type": { + "description": "Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation).", + "type": "string" + } + }, + "type": "object" + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Provides additional information about an http error response.", + "properties": { + "additionalInfo": { + "description": "Gets or sets additional error info.", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true, + "type": "array" + }, + "code": { + "description": "Error code.", + "type": "string" + }, + "details": { + "description": "Gets or sets details for the error.", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true, + "type": "array" + }, + "message": { + "description": "The error message parsed from the body of the http error response.", + "type": "string" + }, + "target": { + "description": "Gets or sets the target of the error.", + "type": "string" + } + }, + "type": "object" + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "ContactInfo": { + "description": "Contact Info.", + "required": [ + "contactName", + "phone" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "minLength": 1, + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "minLength": 1, + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "GranularCopyLogDetails": { + "description": "Granular Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "DataBoxCustomerDiskCopyProgress": { + "description": "DataBox CustomerDisk Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DeviceErasureDetails": { + "description": "Device erasure details with erasure completion status and erasureordestructionlog sas key", + "type": "object", + "properties": { + "deviceErasureStatus": { + "description": "Holds the device erasure completion status", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action for clean up." + } + ] + } + }, + "erasureOrDestructionCertificateSasKey": { + "description": "Shared access key to download cleanup or destruction certificate for device", + "type": "string", + "readOnly": true + } + } + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "GranularCopyProgress": { + "description": "Granular Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataBoxCustomerDiskJobDetails": { + "description": "Customer disk job details.", + "required": [ + "jobDetailsType", + "returnToCustomerPackageDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "importDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for import jobs.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ImportDiskDetails" + } + }, + "exportDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for export jobs.", + "type": "object", + "readOnly": true, + "additionalProperties": { + "$ref": "#/definitions/ExportDiskDetails" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxCustomerDiskCopyProgress" + }, + "readOnly": true + }, + "deliverToDcPackageDetails": { + "description": "Delivery package shipping details.", + "$ref": "#/definitions/PackageCarrierInfo", + "readOnly": true + }, + "returnToCustomerPackageDetails": { + "description": "Return package shipping details.", + "$ref": "#/definitions/PackageCarrierDetails" + }, + "enableManifestBackup": { + "description": "Flag to indicate if disk manifest should be backed-up in the Storage Account.", + "type": "boolean", + "default": false + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "CustomerDiskJobSecrets": { + "description": "The secrets related to customer disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "carrierAccountNumber": { + "description": "Carrier Account Number of the customer", + "type": "string", + "readOnly": true, + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DatacenterAddressInstructionResponse": { + "description": "Datacenter instruction for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "communicationInstruction": { + "description": "Data center communication instruction", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressInstruction" + }, + "DatacenterAddressLocationResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "contactPersonName": { + "description": "Contact person name", + "type": "string", + "readOnly": true + }, + "company": { + "description": "Company name", + "type": "string", + "readOnly": true + }, + "street1": { + "description": "Street address line 1", + "type": "string", + "readOnly": true + }, + "street2": { + "description": "Street address line 2", + "type": "string", + "readOnly": true + }, + "street3": { + "description": "Street address line 3", + "type": "string", + "readOnly": true + }, + "city": { + "description": "City name", + "type": "string", + "readOnly": true + }, + "state": { + "description": "name of the state", + "type": "string", + "readOnly": true + }, + "zip": { + "description": "Zip code", + "type": "string", + "readOnly": true + }, + "country": { + "description": "name of the country", + "type": "string", + "readOnly": true + }, + "phone": { + "description": "Phone number", + "type": "string", + "readOnly": true + }, + "phoneExtension": { + "description": "Phone extension", + "type": "string", + "readOnly": true + }, + "addressType": { + "description": "Address type", + "type": "string", + "readOnly": true + }, + "additionalShippingInformation": { + "description": "Special instruction for shipping", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressLocation" + }, + "DatacenterAddressRequest": { + "description": "Request body to get the datacenter address.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the data center address requested.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "DatacenterAddressResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "properties": { + "datacenterAddressType": { + "description": "Data center address type", + "enum": [ + "DatacenterAddressLocation", + "DatacenterAddressInstruction" + ], + "type": "string", + "x-ms-enum": { + "name": "DatacenterAddressType", + "modelAsExtensible": false, + "values": [ + { + "value": "DatacenterAddressLocation", + "description": "Data center address location." + }, + { + "value": "DatacenterAddressInstruction", + "description": "Data center address instruction." + } + ] + } + }, + "supportedCarriersForReturnShipment": { + "description": "List of supported carriers for return shipment.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "dataCenterAzureLocation": { + "description": "Azure Location where the Data Center serves primarily.", + "type": "string", + "readOnly": true + } + }, + "discriminator": "datacenterAddressType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxCustomerDiskCopyLogDetails": { + "description": "Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskGranularCopyLogDetails": { + "description": "Granular Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "accountId": { + "description": "Account id.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "DataBoxDiskGranularCopyProgress": { + "description": "DataBox Disk Granular Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "granularCopyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyProgress" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "granularCopyLogDetails": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyLogDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + }, + "hardwareEncryption": { + "description": "Defines Hardware level encryption (Only for disk)", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "HardwareEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Hardware-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Hardware-based encryption is enabled." + } + ] + } + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "ExportDiskDetails": { + "description": "Export disk details", + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "ImportDiskDetails": { + "description": "Import disk details", + "required": [ + "manifestFile", + "manifestHash", + "bitLockerKey" + ], + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string" + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string" + }, + "bitLockerKey": { + "description": "BitLocker key used to encrypt the disk.", + "type": "string", + "x-ms-secret": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails", + "description": "Optional Reverse Shipping details for order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "deviceErasureDetails": { + "$ref": "#/definitions/DeviceErasureDetails", + "description": "Holds device data erasure details", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + }, + "datacenterAddress": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address to ship to, for the given sku and storage location.", + "readOnly": true + }, + "dataCenterCode": { + "description": "DataCenter code.", + "enum": [ + "Invalid", + "BY2", + "BY1", + "ORK70", + "AM2", + "AMS20", + "BY21", + "BY24", + "MWH01", + "AMS06", + "SSE90", + "SYD03", + "SYD23", + "CBR20", + "YTO20", + "CWL20", + "LON24", + "BOM01", + "BL20", + "BL7", + "SEL20", + "TYO01", + "BN1", + "SN5", + "CYS04", + "TYO22", + "YTO21", + "YQB20", + "FRA22", + "MAA01", + "CPQ02", + "CPQ20", + "SIN20", + "HKG20", + "SG2", + "MEL23", + "SEL21", + "OSA20", + "SHA03", + "BJB", + "JNB22", + "JNB21", + "MNZ21", + "SN8", + "AUH20", + "ZRH20", + "PUS20", + "AdHoc", + "CH1", + "DSM05", + "DUB07", + "PNQ01", + "SVG20", + "OSA02", + "OSA22", + "PAR22", + "BN7", + "SN6", + "BJS20" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataCenterCode", + "modelAsString": true, + "values": [ + { + "value": "Invalid" + }, + { + "value": "BY2" + }, + { + "value": "BY1" + }, + { + "value": "ORK70" + }, + { + "value": "AM2" + }, + { + "value": "AMS20" + }, + { + "value": "BY21" + }, + { + "value": "BY24" + }, + { + "value": "MWH01" + }, + { + "value": "AMS06" + }, + { + "value": "SSE90" + }, + { + "value": "SYD03" + }, + { + "value": "SYD23" + }, + { + "value": "CBR20" + }, + { + "value": "YTO20" + }, + { + "value": "CWL20" + }, + { + "value": "LON24" + }, + { + "value": "BOM01" + }, + { + "value": "BL20" + }, + { + "value": "BL7" + }, + { + "value": "SEL20" + }, + { + "value": "TYO01" + }, + { + "value": "BN1" + }, + { + "value": "SN5" + }, + { + "value": "CYS04" + }, + { + "value": "TYO22" + }, + { + "value": "YTO21" + }, + { + "value": "YQB20" + }, + { + "value": "FRA22" + }, + { + "value": "MAA01" + }, + { + "value": "CPQ02" + }, + { + "value": "CPQ20" + }, + { + "value": "SIN20" + }, + { + "value": "HKG20" + }, + { + "value": "SG2" + }, + { + "value": "MEL23" + }, + { + "value": "SEL21" + }, + { + "value": "OSA20" + }, + { + "value": "SHA03" + }, + { + "value": "BJB" + }, + { + "value": "JNB22" + }, + { + "value": "JNB21" + }, + { + "value": "MNZ21" + }, + { + "value": "SN8" + }, + { + "value": "AUH20" + }, + { + "value": "ZRH20" + }, + { + "value": "PUS20" + }, + { + "value": "AdHoc" + }, + { + "value": "CH1" + }, + { + "value": "DSM05" + }, + { + "value": "DUB07" + }, + { + "value": "PNQ01" + }, + { + "value": "SVG20" + }, + { + "value": "OSA02" + }, + { + "value": "OSA22" + }, + { + "value": "PAR22" + }, + { + "value": "BN7" + }, + { + "value": "SN6" + }, + { + "value": "BJS20" + } + ] + } + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "reverseShippingDetailsUpdate": { + "description": "The Editable status for Reverse Shipping Address and Contact Info", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseShippingDetailsEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse shipping details can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse shipping details." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse shipping details. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "reverseTransportPreferenceUpdate": { + "description": "The Editable status for Reverse Transport preferences", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseTransportPreferenceEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse Transport Preferences can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse Transport Preferences." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse Transport Preferences. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "MarkDevicesShippedRequest": { + "description": "The request body to provide the delivery package details of job", + "required": [ + "deliverToDcPackageDetails" + ], + "type": "object", + "properties": { + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package details" + } + } + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "serialNumberCustomerResolutionMap": { + "description": "Serial number and the customer resolution code corresponding to each serial number", + "type": "object", + "additionalProperties": { + "format": "int32", + "description": "Available customer resolution codes on a job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job" + }, + { + "value": "Restart", + "description": "Restart whole action" + }, + { + "value": "ReachOutToOperation", + "description": "Reach out to operation for further action" + } + ] + } + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Created", + "ShippedToCustomer" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsString": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + }, + { + "value": "Created", + "description": "Notification at job created stage." + }, + { + "value": "ShippedToCustomer", + "description": "Notification at shipped devices to customer stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageCarrierDetails": { + "description": "Package carrier details.", + "type": "object", + "properties": { + "carrierAccountNumber": { + "description": "Carrier Account Number of customer for customer disk.", + "type": "string", + "x-ms-secret": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageCarrierInfo": { + "description": "package carrier info", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageShippingDetails": { + "description": "package shipping details", + "type": "object", + "properties": { + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "reverseTransportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Optional Preferences related to the reverse shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + }, + "storageAccountAccessTierPreferences": { + "description": "Preferences related to the Access Tier of storage accounts.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "Archive" + ], + "type": "string", + "x-ms-enum": { + "name": "StorageAccountAccessTier", + "modelAsExtensible": true, + "values": [ + { + "value": "Archive", + "description": "Archive Access Tier shares requested by the customer." + } + ] + } + } + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + }, + "datacenterAddressRequest": { + "$ref": "#/definitions/DatacenterAddressRequest", + "description": "Request body to get the datacenter address for given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + }, + "datacenterAddressResponse": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address for given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ReverseShippingDetails": { + "description": "Reverse Shipping Address and contact details for a job.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactInfo" + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress" + }, + "isUpdated": { + "description": "A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared.\r\nRead only field", + "type": "boolean", + "readOnly": true + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + }, + "skipAddressValidation": { + "type": "boolean", + "description": "Flag to indicate if customer has chosen to skip default address validation" + }, + "taxIdentificationNumber": { + "type": "string", + "description": "Tax Identification Number" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + }, + "countriesWithinCommerceBoundary": { + "description": "List of all the Countries in the SKU specific commerce boundary", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + }, + "isUpdated": { + "description": "Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + "type": "boolean", + "readOnly": true + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails" + }, + "preferences": { + "$ref": "#/definitions/Preferences" + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package details of job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2023-03-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2023-03-01/databox.json new file mode 100644 index 00000000000..b1a5204fb79 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2023-03-01/databox.json @@ -0,0 +1,7083 @@ +{ + "swagger": "2.0", + "info": { + "version": "2023-03-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mark devices for a given job as shipped", + "operationId": "Jobs_MarkDevicesShipped", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "markDevicesShippedRequest", + "in": "body", + "description": "Mark Devices Shipped Request", + "required": true, + "schema": { + "$ref": "#/definitions/MarkDevicesShippedRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "MarkDevicesShipped": { + "$ref": "./examples/MarkDevicesShipped.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + }, + "JobsGetWaitingForAction": { + "$ref": "./examples/JobsGetWaitingForAction.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "description": "This class represents additional info which Resource Providers pass when an error occurs.", + "properties": { + "info": { + "description": "Additional information of the type of error.", + "type": "object" + }, + "type": { + "description": "Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation).", + "type": "string" + } + }, + "type": "object" + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Provides additional information about an http error response.", + "properties": { + "additionalInfo": { + "description": "Gets or sets additional error info.", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true, + "type": "array" + }, + "code": { + "description": "Error code.", + "type": "string" + }, + "details": { + "description": "Gets or sets details for the error.", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true, + "type": "array" + }, + "message": { + "description": "The error message parsed from the body of the http error response.", + "type": "string" + }, + "target": { + "description": "Gets or sets the target of the error.", + "type": "string" + } + }, + "type": "object" + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "ContactInfo": { + "description": "Contact Info.", + "required": [ + "contactName", + "phone" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "minLength": 1, + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "minLength": 1, + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "GranularCopyLogDetails": { + "description": "Granular Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "DataBoxCustomerDiskCopyProgress": { + "description": "DataBox CustomerDisk Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DeviceErasureDetails": { + "description": "Device erasure details with erasure completion status and erasureordestructionlog sas key", + "type": "object", + "properties": { + "deviceErasureStatus": { + "description": "Holds the device erasure completion status", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action for clean up." + } + ] + } + }, + "erasureOrDestructionCertificateSasKey": { + "description": "Shared access key to download cleanup or destruction certificate for device", + "type": "string", + "readOnly": true + } + } + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "GranularCopyProgress": { + "description": "Granular Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataBoxCustomerDiskJobDetails": { + "description": "Customer disk job details.", + "required": [ + "jobDetailsType", + "returnToCustomerPackageDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "importDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for import jobs.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ImportDiskDetails" + } + }, + "exportDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for export jobs.", + "type": "object", + "readOnly": true, + "additionalProperties": { + "$ref": "#/definitions/ExportDiskDetails" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxCustomerDiskCopyProgress" + }, + "readOnly": true + }, + "deliverToDcPackageDetails": { + "description": "Delivery package shipping details.", + "$ref": "#/definitions/PackageCarrierInfo", + "readOnly": true + }, + "returnToCustomerPackageDetails": { + "description": "Return package shipping details.", + "$ref": "#/definitions/PackageCarrierDetails" + }, + "enableManifestBackup": { + "description": "Flag to indicate if disk manifest should be backed-up in the Storage Account.", + "type": "boolean", + "default": false + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "CustomerDiskJobSecrets": { + "description": "The secrets related to customer disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "carrierAccountNumber": { + "description": "Carrier Account Number of the customer", + "type": "string", + "readOnly": true, + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DatacenterAddressInstructionResponse": { + "description": "Datacenter instruction for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "communicationInstruction": { + "description": "Data center communication instruction", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressInstruction" + }, + "DatacenterAddressLocationResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "contactPersonName": { + "description": "Contact person name", + "type": "string", + "readOnly": true + }, + "company": { + "description": "Company name", + "type": "string", + "readOnly": true + }, + "street1": { + "description": "Street address line 1", + "type": "string", + "readOnly": true + }, + "street2": { + "description": "Street address line 2", + "type": "string", + "readOnly": true + }, + "street3": { + "description": "Street address line 3", + "type": "string", + "readOnly": true + }, + "city": { + "description": "City name", + "type": "string", + "readOnly": true + }, + "state": { + "description": "name of the state", + "type": "string", + "readOnly": true + }, + "zip": { + "description": "Zip code", + "type": "string", + "readOnly": true + }, + "country": { + "description": "name of the country", + "type": "string", + "readOnly": true + }, + "phone": { + "description": "Phone number", + "type": "string", + "readOnly": true + }, + "phoneExtension": { + "description": "Phone extension", + "type": "string", + "readOnly": true + }, + "addressType": { + "description": "Address type", + "type": "string", + "readOnly": true + }, + "additionalShippingInformation": { + "description": "Special instruction for shipping", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressLocation" + }, + "DatacenterAddressRequest": { + "description": "Request body to get the datacenter address.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the data center address requested.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "DatacenterAddressResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "properties": { + "datacenterAddressType": { + "description": "Data center address type", + "enum": [ + "DatacenterAddressLocation", + "DatacenterAddressInstruction" + ], + "type": "string", + "x-ms-enum": { + "name": "DatacenterAddressType", + "modelAsExtensible": false, + "values": [ + { + "value": "DatacenterAddressLocation", + "description": "Data center address location." + }, + { + "value": "DatacenterAddressInstruction", + "description": "Data center address instruction." + } + ] + } + }, + "supportedCarriersForReturnShipment": { + "description": "List of supported carriers for return shipment.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "dataCenterAzureLocation": { + "description": "Azure Location where the Data Center serves primarily.", + "type": "string", + "readOnly": true + } + }, + "discriminator": "datacenterAddressType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxCustomerDiskCopyLogDetails": { + "description": "Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskGranularCopyLogDetails": { + "description": "Granular Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "accountId": { + "description": "Account id.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "DataBoxDiskGranularCopyProgress": { + "description": "DataBox Disk Granular Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "granularCopyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyProgress" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "granularCopyLogDetails": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyLogDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + }, + "hardwareEncryption": { + "description": "Defines Hardware level encryption (Only for disk)", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "HardwareEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Hardware-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Hardware-based encryption is enabled." + } + ] + } + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "ExportDiskDetails": { + "description": "Export disk details", + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "ImportDiskDetails": { + "description": "Import disk details", + "required": [ + "manifestFile", + "manifestHash", + "bitLockerKey" + ], + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string" + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string" + }, + "bitLockerKey": { + "description": "BitLocker key used to encrypt the disk.", + "type": "string", + "x-ms-secret": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDelayDetails": { + "description": "Job Delay Notification details", + "type": "object", + "properties": { + "status": { + "description": "Status of notification", + "enum": [ + "Active", + "Resolved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DelayNotificationStatus", + "modelAsString": true, + "values": [ + { + "value": "Active", + "description": "Delay is still active" + }, + { + "value": "Resolved", + "description": "Delay has been resolved" + } + ] + } + }, + "errorCode": { + "description": "Delay Error code", + "enum": [ + "InternalIssueDelay", + "ActiveOrderLimitBreachedDelay", + "HighDemandDelay", + "LargeNumberOfFilesDelay" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "PortalDelayErrorCode", + "modelAsString": true, + "values": [ + { + "value": "InternalIssueDelay", + "description": "Delay due to any internal reasons" + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "Active Order limit breached." + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "High demand" + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "Slow copy due to large number of files" + } + ] + } + }, + "description": { + "description": "Description of the delay.", + "type": "string", + "readOnly": true + }, + "startTime": { + "format": "date-time", + "description": "Timestamp when the delay notification was created.", + "type": "string", + "readOnly": true + }, + "resolutionTime": { + "format": "date-time", + "description": "Timestamp when the delay notification was resolved.", + "type": "string", + "readOnly": true + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails", + "description": "Optional Reverse Shipping details for order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "deviceErasureDetails": { + "$ref": "#/definitions/DeviceErasureDetails", + "description": "Holds device data erasure details", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + }, + "datacenterAddress": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address to ship to, for the given sku and storage location.", + "readOnly": true + }, + "dataCenterCode": { + "description": "DataCenter code.", + "enum": [ + "Invalid", + "BY2", + "BY1", + "ORK70", + "AM2", + "AMS20", + "BY21", + "BY24", + "MWH01", + "AMS06", + "SSE90", + "SYD03", + "SYD23", + "CBR20", + "YTO20", + "CWL20", + "LON24", + "BOM01", + "BL20", + "BL7", + "SEL20", + "TYO01", + "BN1", + "SN5", + "CYS04", + "TYO22", + "YTO21", + "YQB20", + "FRA22", + "MAA01", + "CPQ02", + "CPQ20", + "SIN20", + "HKG20", + "SG2", + "MEL23", + "SEL21", + "OSA20", + "SHA03", + "BJB", + "JNB22", + "JNB21", + "MNZ21", + "SN8", + "AUH20", + "ZRH20", + "PUS20", + "AdHoc", + "CH1", + "DSM05", + "DUB07", + "PNQ01", + "SVG20", + "OSA02", + "OSA22", + "PAR22", + "BN7", + "SN6", + "BJS20" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataCenterCode", + "modelAsString": true, + "values": [ + { + "value": "Invalid" + }, + { + "value": "BY2" + }, + { + "value": "BY1" + }, + { + "value": "ORK70" + }, + { + "value": "AM2" + }, + { + "value": "AMS20" + }, + { + "value": "BY21" + }, + { + "value": "BY24" + }, + { + "value": "MWH01" + }, + { + "value": "AMS06" + }, + { + "value": "SSE90" + }, + { + "value": "SYD03" + }, + { + "value": "SYD23" + }, + { + "value": "CBR20" + }, + { + "value": "YTO20" + }, + { + "value": "CWL20" + }, + { + "value": "LON24" + }, + { + "value": "BOM01" + }, + { + "value": "BL20" + }, + { + "value": "BL7" + }, + { + "value": "SEL20" + }, + { + "value": "TYO01" + }, + { + "value": "BN1" + }, + { + "value": "SN5" + }, + { + "value": "CYS04" + }, + { + "value": "TYO22" + }, + { + "value": "YTO21" + }, + { + "value": "YQB20" + }, + { + "value": "FRA22" + }, + { + "value": "MAA01" + }, + { + "value": "CPQ02" + }, + { + "value": "CPQ20" + }, + { + "value": "SIN20" + }, + { + "value": "HKG20" + }, + { + "value": "SG2" + }, + { + "value": "MEL23" + }, + { + "value": "SEL21" + }, + { + "value": "OSA20" + }, + { + "value": "SHA03" + }, + { + "value": "BJB" + }, + { + "value": "JNB22" + }, + { + "value": "JNB21" + }, + { + "value": "MNZ21" + }, + { + "value": "SN8" + }, + { + "value": "AUH20" + }, + { + "value": "ZRH20" + }, + { + "value": "PUS20" + }, + { + "value": "AdHoc" + }, + { + "value": "CH1" + }, + { + "value": "DSM05" + }, + { + "value": "DUB07" + }, + { + "value": "PNQ01" + }, + { + "value": "SVG20" + }, + { + "value": "OSA02" + }, + { + "value": "OSA22" + }, + { + "value": "PAR22" + }, + { + "value": "BN7" + }, + { + "value": "SN6" + }, + { + "value": "BJS20" + } + ] + } + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "reverseShippingDetailsUpdate": { + "description": "The Editable status for Reverse Shipping Address and Contact Info", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseShippingDetailsEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse shipping details can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse shipping details." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse shipping details. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "reverseTransportPreferenceUpdate": { + "description": "The Editable status for Reverse Transport preferences", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseTransportPreferenceEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse Transport Preferences can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse Transport Preferences." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse Transport Preferences. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "delayedStage": { + "description": "Name of the stage where delay might be present.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + }, + "delayInformation": { + "description": "Delay information for the job stages.", + "type": "array", + "items": { + "$ref": "#/definitions/JobDelayDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "MarkDevicesShippedRequest": { + "description": "The request body to provide the delivery package details of job", + "required": [ + "deliverToDcPackageDetails" + ], + "type": "object", + "properties": { + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package details" + } + } + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "serialNumberCustomerResolutionMap": { + "description": "Serial number and the customer resolution code corresponding to each serial number", + "type": "object", + "additionalProperties": { + "format": "int32", + "description": "Available customer resolution codes on a job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job" + }, + { + "value": "Restart", + "description": "Restart whole action" + }, + { + "value": "ReachOutToOperation", + "description": "Reach out to operation for further action" + } + ] + } + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Created", + "ShippedToCustomer" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsString": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + }, + { + "value": "Created", + "description": "Notification at job created stage." + }, + { + "value": "ShippedToCustomer", + "description": "Notification at shipped devices to customer stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageCarrierDetails": { + "description": "Package carrier details.", + "type": "object", + "properties": { + "carrierAccountNumber": { + "description": "Carrier Account Number of customer for customer disk.", + "type": "string", + "x-ms-secret": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageCarrierInfo": { + "description": "package carrier info", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageShippingDetails": { + "description": "package shipping details", + "type": "object", + "properties": { + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "reverseTransportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Optional Preferences related to the reverse shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + }, + "storageAccountAccessTierPreferences": { + "description": "Preferences related to the Access Tier of storage accounts.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "Archive" + ], + "type": "string", + "x-ms-enum": { + "name": "StorageAccountAccessTier", + "modelAsExtensible": true, + "values": [ + { + "value": "Archive", + "description": "Archive Access Tier shares requested by the customer." + } + ] + } + } + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + }, + "datacenterAddressRequest": { + "$ref": "#/definitions/DatacenterAddressRequest", + "description": "Request body to get the datacenter address for given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + }, + "datacenterAddressResponse": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address for given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ReverseShippingDetails": { + "description": "Reverse Shipping Address and contact details for a job.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactInfo" + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress" + }, + "isUpdated": { + "description": "A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared.\r\nRead only field", + "type": "boolean", + "readOnly": true + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + }, + "skipAddressValidation": { + "type": "boolean", + "description": "Flag to indicate if customer has chosen to skip default address validation" + }, + "taxIdentificationNumber": { + "type": "string", + "description": "Tax Identification Number" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + }, + "countriesWithinCommerceBoundary": { + "description": "List of all the Countries in the SKU specific commerce boundary", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + }, + "isUpdated": { + "description": "Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + "type": "boolean", + "readOnly": true + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails" + }, + "preferences": { + "$ref": "#/definitions/Preferences" + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package details of job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2023-12-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2023-12-01/databox.json new file mode 100644 index 00000000000..19e77823f51 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2023-12-01/databox.json @@ -0,0 +1,7210 @@ +{ + "swagger": "2.0", + "info": { + "version": "2023-12-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mark devices for a given job as shipped", + "operationId": "Jobs_MarkDevicesShipped", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "markDevicesShippedRequest", + "in": "body", + "description": "Mark Devices Shipped Request", + "required": true, + "schema": { + "$ref": "#/definitions/MarkDevicesShippedRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "MarkDevicesShipped": { + "$ref": "./examples/MarkDevicesShipped.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + }, + "JobsGetWaitingForAction": { + "$ref": "./examples/JobsGetWaitingForAction.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "description": "This class represents additional info which Resource Providers pass when an error occurs.", + "properties": { + "info": { + "description": "Additional information of the type of error.", + "type": "object" + }, + "type": { + "description": "Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation).", + "type": "string" + } + }, + "type": "object" + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Provides additional information about an http error response.", + "properties": { + "additionalInfo": { + "description": "Gets or sets additional error info.", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true, + "type": "array" + }, + "code": { + "description": "Error code.", + "type": "string" + }, + "details": { + "description": "Gets or sets details for the error.", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true, + "type": "array" + }, + "message": { + "description": "The error message parsed from the body of the http error response.", + "type": "string" + }, + "target": { + "description": "Gets or sets the target of the error.", + "type": "string" + } + }, + "type": "object" + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "ContactInfo": { + "description": "Contact Info.", + "required": [ + "contactName", + "phone" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "minLength": 1, + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "minLength": 1, + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "GranularCopyLogDetails": { + "description": "Granular Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "DataBoxCustomerDiskCopyProgress": { + "description": "DataBox CustomerDisk Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DeviceErasureDetails": { + "description": "Device erasure details with erasure completion status and erasureordestructionlog sas key", + "type": "object", + "properties": { + "deviceErasureStatus": { + "description": "Holds the device erasure completion status", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action for clean up." + } + ] + } + }, + "erasureOrDestructionCertificateSasKey": { + "description": "Shared access key to download cleanup or destruction certificate for device", + "type": "string", + "readOnly": true + } + } + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "GranularCopyProgress": { + "description": "Granular Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataBoxCustomerDiskJobDetails": { + "description": "Customer disk job details.", + "required": [ + "jobDetailsType", + "returnToCustomerPackageDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "importDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for import jobs.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ImportDiskDetails" + } + }, + "exportDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for export jobs.", + "type": "object", + "readOnly": true, + "additionalProperties": { + "$ref": "#/definitions/ExportDiskDetails" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxCustomerDiskCopyProgress" + }, + "readOnly": true + }, + "deliverToDcPackageDetails": { + "description": "Delivery package shipping details.", + "$ref": "#/definitions/PackageCarrierInfo", + "readOnly": true + }, + "returnToCustomerPackageDetails": { + "description": "Return package shipping details.", + "$ref": "#/definitions/PackageCarrierDetails" + }, + "enableManifestBackup": { + "description": "Flag to indicate if disk manifest should be backed-up in the Storage Account.", + "type": "boolean", + "default": false + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "CustomerDiskJobSecrets": { + "description": "The secrets related to customer disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "carrierAccountNumber": { + "description": "Carrier Account Number of the customer", + "type": "string", + "readOnly": true, + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DatacenterAddressInstructionResponse": { + "description": "Datacenter instruction for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "communicationInstruction": { + "description": "Data center communication instruction", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressInstruction" + }, + "DatacenterAddressLocationResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "contactPersonName": { + "description": "Contact person name", + "type": "string", + "readOnly": true + }, + "company": { + "description": "Company name", + "type": "string", + "readOnly": true + }, + "street1": { + "description": "Street address line 1", + "type": "string", + "readOnly": true + }, + "street2": { + "description": "Street address line 2", + "type": "string", + "readOnly": true + }, + "street3": { + "description": "Street address line 3", + "type": "string", + "readOnly": true + }, + "city": { + "description": "City name", + "type": "string", + "readOnly": true + }, + "state": { + "description": "name of the state", + "type": "string", + "readOnly": true + }, + "zip": { + "description": "Zip code", + "type": "string", + "readOnly": true + }, + "country": { + "description": "name of the country", + "type": "string", + "readOnly": true + }, + "phone": { + "description": "Phone number", + "type": "string", + "readOnly": true + }, + "phoneExtension": { + "description": "Phone extension", + "type": "string", + "readOnly": true + }, + "addressType": { + "description": "Address type", + "type": "string", + "readOnly": true + }, + "additionalShippingInformation": { + "description": "Special instruction for shipping", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressLocation" + }, + "DatacenterAddressRequest": { + "description": "Request body to get the datacenter address.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the data center address requested.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "DatacenterAddressResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "properties": { + "datacenterAddressType": { + "description": "Data center address type", + "enum": [ + "DatacenterAddressLocation", + "DatacenterAddressInstruction" + ], + "type": "string", + "x-ms-enum": { + "name": "DatacenterAddressType", + "modelAsExtensible": false, + "values": [ + { + "value": "DatacenterAddressLocation", + "description": "Data center address location." + }, + { + "value": "DatacenterAddressInstruction", + "description": "Data center address instruction." + } + ] + } + }, + "supportedCarriersForReturnShipment": { + "description": "List of supported carriers for return shipment.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "dataCenterAzureLocation": { + "description": "Azure Location where the Data Center serves primarily.", + "type": "string", + "readOnly": true + } + }, + "discriminator": "datacenterAddressType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxCustomerDiskCopyLogDetails": { + "description": "Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskGranularCopyLogDetails": { + "description": "Granular Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "accountId": { + "description": "Account id.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "DataBoxDiskGranularCopyProgress": { + "description": "DataBox Disk Granular Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "granularCopyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyProgress" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "granularCopyLogDetails": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyLogDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DeviceCapabilityDetails": { + "description": "Device capability details for a given sku for a given region.", + "type": "object", + "properties": { + "hardwareEncryption": { + "description": "Hardware encryption support for a given sku for a given region.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "HardwareEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Hardware-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Hardware-based encryption is disabled." + } + ] + } + } + } + }, + "DeviceCapabilityRequest": { + "description": "Request body to get the device capabilities for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "DeviceCapabilityResponse": { + "description": "Device capabilities for given sku in a region", + "type": "object", + "properties": { + "deviceCapabilityDetails": { + "description": "List of device capabilities available for a given region and a given sku", + "type": "array", + "items": { + "$ref": "#/definitions/DeviceCapabilityDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + }, + "hardwareEncryption": { + "description": "Defines Hardware level encryption (Only for disk)", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "HardwareEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Hardware-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Hardware-based encryption is enabled." + } + ] + } + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "ExportDiskDetails": { + "description": "Export disk details", + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "ImportDiskDetails": { + "description": "Import disk details", + "required": [ + "manifestFile", + "manifestHash", + "bitLockerKey" + ], + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string" + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string" + }, + "bitLockerKey": { + "description": "BitLocker key used to encrypt the disk.", + "type": "string", + "x-ms-secret": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDelayDetails": { + "description": "Job Delay Notification details", + "type": "object", + "properties": { + "status": { + "description": "Status of notification", + "enum": [ + "Active", + "Resolved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DelayNotificationStatus", + "modelAsString": true, + "values": [ + { + "value": "Active", + "description": "Delay is still active" + }, + { + "value": "Resolved", + "description": "Delay has been resolved" + } + ] + } + }, + "errorCode": { + "description": "Delay Error code", + "enum": [ + "InternalIssueDelay", + "ActiveOrderLimitBreachedDelay", + "HighDemandDelay", + "LargeNumberOfFilesDelay" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "PortalDelayErrorCode", + "modelAsString": true, + "values": [ + { + "value": "InternalIssueDelay", + "description": "Delay due to any internal reasons" + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "Active Order limit breached." + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "High demand" + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "Slow copy due to large number of files" + } + ] + } + }, + "description": { + "description": "Description of the delay.", + "type": "string", + "readOnly": true + }, + "startTime": { + "format": "date-time", + "description": "Timestamp when the delay notification was created.", + "type": "string", + "readOnly": true + }, + "resolutionTime": { + "format": "date-time", + "description": "Timestamp when the delay notification was resolved.", + "type": "string", + "readOnly": true + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails", + "description": "Optional Reverse Shipping details for order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "deviceErasureDetails": { + "$ref": "#/definitions/DeviceErasureDetails", + "description": "Holds device data erasure details", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + }, + "datacenterAddress": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address to ship to, for the given sku and storage location.", + "readOnly": true + }, + "dataCenterCode": { + "description": "DataCenter code.", + "enum": [ + "Invalid", + "BY2", + "BY1", + "ORK70", + "AM2", + "AMS20", + "BY21", + "BY24", + "MWH01", + "AMS06", + "SSE90", + "SYD03", + "SYD23", + "CBR20", + "YTO20", + "CWL20", + "LON24", + "BOM01", + "BL20", + "BL7", + "SEL20", + "TYO01", + "BN1", + "SN5", + "CYS04", + "TYO22", + "YTO21", + "YQB20", + "FRA22", + "MAA01", + "CPQ02", + "CPQ20", + "SIN20", + "HKG20", + "SG2", + "MEL23", + "SEL21", + "OSA20", + "SHA03", + "BJB", + "JNB22", + "JNB21", + "MNZ21", + "SN8", + "AUH20", + "ZRH20", + "PUS20", + "AdHoc", + "CH1", + "DSM05", + "DUB07", + "PNQ01", + "SVG20", + "OSA02", + "OSA22", + "PAR22", + "BN7", + "SN6", + "BJS20", + "BL24", + "IDC5", + "TYO23", + "NTG20", + "DXB23", + "DSM11", + "AMS25", + "CPQ21", + "OSA23" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataCenterCode", + "modelAsString": true, + "values": [ + { + "value": "Invalid" + }, + { + "value": "BY2" + }, + { + "value": "BY1" + }, + { + "value": "ORK70" + }, + { + "value": "AM2" + }, + { + "value": "AMS20" + }, + { + "value": "BY21" + }, + { + "value": "BY24" + }, + { + "value": "MWH01" + }, + { + "value": "AMS06" + }, + { + "value": "SSE90" + }, + { + "value": "SYD03" + }, + { + "value": "SYD23" + }, + { + "value": "CBR20" + }, + { + "value": "YTO20" + }, + { + "value": "CWL20" + }, + { + "value": "LON24" + }, + { + "value": "BOM01" + }, + { + "value": "BL20" + }, + { + "value": "BL7" + }, + { + "value": "SEL20" + }, + { + "value": "TYO01" + }, + { + "value": "BN1" + }, + { + "value": "SN5" + }, + { + "value": "CYS04" + }, + { + "value": "TYO22" + }, + { + "value": "YTO21" + }, + { + "value": "YQB20" + }, + { + "value": "FRA22" + }, + { + "value": "MAA01" + }, + { + "value": "CPQ02" + }, + { + "value": "CPQ20" + }, + { + "value": "SIN20" + }, + { + "value": "HKG20" + }, + { + "value": "SG2" + }, + { + "value": "MEL23" + }, + { + "value": "SEL21" + }, + { + "value": "OSA20" + }, + { + "value": "SHA03" + }, + { + "value": "BJB" + }, + { + "value": "JNB22" + }, + { + "value": "JNB21" + }, + { + "value": "MNZ21" + }, + { + "value": "SN8" + }, + { + "value": "AUH20" + }, + { + "value": "ZRH20" + }, + { + "value": "PUS20" + }, + { + "value": "AdHoc" + }, + { + "value": "CH1" + }, + { + "value": "DSM05" + }, + { + "value": "DUB07" + }, + { + "value": "PNQ01" + }, + { + "value": "SVG20" + }, + { + "value": "OSA02" + }, + { + "value": "OSA22" + }, + { + "value": "PAR22" + }, + { + "value": "BN7" + }, + { + "value": "SN6" + }, + { + "value": "BJS20" + }, + { + "value": "BL24" + }, + { + "value": "IDC5" + }, + { + "value": "TYO23" + }, + { + "value": "CPQ21" + }, + { + "value": "NTG20" + }, + { + "value": "DXB23" + }, + { + "value": "DSM11" + }, + { + "value": "OSA23" + }, + { + "value": "AMS25" + } + ] + } + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "reverseShippingDetailsUpdate": { + "description": "The Editable status for Reverse Shipping Address and Contact Info", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseShippingDetailsEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse shipping details can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse shipping details." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse shipping details. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "reverseTransportPreferenceUpdate": { + "description": "The Editable status for Reverse Transport preferences", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseTransportPreferenceEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse Transport Preferences can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse Transport Preferences." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse Transport Preferences. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "delayedStage": { + "description": "Name of the stage where delay might be present.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + }, + "delayInformation": { + "description": "Delay information for the job stages.", + "type": "array", + "items": { + "$ref": "#/definitions/JobDelayDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "MarkDevicesShippedRequest": { + "description": "The request body to provide the delivery package details of job", + "required": [ + "deliverToDcPackageDetails" + ], + "type": "object", + "properties": { + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package details" + } + } + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "serialNumberCustomerResolutionMap": { + "description": "Serial number and the customer resolution code corresponding to each serial number", + "type": "object", + "additionalProperties": { + "format": "int32", + "description": "Available customer resolution codes on a job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job" + }, + { + "value": "Restart", + "description": "Restart whole action" + }, + { + "value": "ReachOutToOperation", + "description": "Reach out to operation for further action" + } + ] + } + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Created", + "ShippedToCustomer" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsString": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + }, + { + "value": "Created", + "description": "Notification at job created stage." + }, + { + "value": "ShippedToCustomer", + "description": "Notification at shipped devices to customer stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageCarrierDetails": { + "description": "Package carrier details.", + "type": "object", + "properties": { + "carrierAccountNumber": { + "description": "Carrier Account Number of customer for customer disk.", + "type": "string", + "x-ms-secret": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageCarrierInfo": { + "description": "package carrier info", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageShippingDetails": { + "description": "package shipping details", + "type": "object", + "properties": { + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "reverseTransportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Optional Preferences related to the reverse shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + }, + "storageAccountAccessTierPreferences": { + "description": "Preferences related to the Access Tier of storage accounts.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "Archive" + ], + "type": "string", + "x-ms-enum": { + "name": "StorageAccountAccessTier", + "modelAsExtensible": true, + "values": [ + { + "value": "Archive", + "description": "Archive Access Tier shares requested by the customer." + } + ] + } + } + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + }, + "datacenterAddressRequest": { + "$ref": "#/definitions/DatacenterAddressRequest", + "description": "Request body to get the datacenter address for given sku." + }, + "deviceCapabilityRequest": { + "$ref": "#/definitions/DeviceCapabilityRequest", + "description": "Request body to get the device capabilities for a given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + }, + "datacenterAddressResponse": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address for given sku in a region.", + "readOnly": true + }, + "deviceCapabilityResponse": { + "$ref": "#/definitions/DeviceCapabilityResponse", + "description": "Device capabilities available for a given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ReverseShippingDetails": { + "description": "Reverse Shipping Address and contact details for a job.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactInfo" + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress" + }, + "isUpdated": { + "description": "A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared.\r\nRead only field", + "type": "boolean", + "readOnly": true + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + }, + "skipAddressValidation": { + "type": "boolean", + "description": "Flag to indicate if customer has chosen to skip default address validation" + }, + "taxIdentificationNumber": { + "type": "string", + "description": "Tax Identification Number" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + }, + "countriesWithinCommerceBoundary": { + "description": "List of all the Countries in the SKU specific commerce boundary", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + }, + "isUpdated": { + "description": "Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + "type": "boolean", + "readOnly": true + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails" + }, + "preferences": { + "$ref": "#/definitions/Preferences" + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package details of job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2025-02-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2025-02-01/databox.json new file mode 100644 index 00000000000..01144e092bf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2025-02-01/databox.json @@ -0,0 +1,7292 @@ +{ + "swagger": "2.0", + "info": { + "version": "2025-02-01", + "title": "DataBoxManagementClient" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "This method gets all the operations.", + "operationId": "Operations_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The supported operations list.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "OperationsGet": { + "$ref": "./examples/OperationsGet.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the subscription.", + "operationId": "Jobs_List", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs available under the subscription.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsList": { + "$ref": "./examples/JobsList.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mitigate for a given job", + "operationId": "Mitigate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "Mitigate": { + "$ref": "./examples/JobMitigate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Request to mark devices for a given job as shipped", + "operationId": "Jobs_MarkDevicesShipped", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "markDevicesShippedRequest", + "in": "body", + "description": "Mark Devices Shipped Request", + "required": true, + "schema": { + "$ref": "#/definitions/MarkDevicesShippedRequest" + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "MarkDevicesShipped": { + "$ref": "./examples/MarkDevicesShipped.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "tags": [ + "Service" + ], + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "operationId": "Service_ListAvailableSkusByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "The list of available skus under Resource group.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "AvailableSkusPost": { + "$ref": "./examples/AvailableSkusPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "tags": [ + "Service" + ], + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "operationId": "Service_ValidateAddress", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "Shipping address of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The valid and alternate addresses.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true, + "x-ms-examples": { + "ValidateAddressPost": { + "$ref": "./examples/ValidateAddressPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under resource group.", + "operationId": "Service_ValidateInputsByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputsByResourceGroup": { + "$ref": "./examples/ValidateInputsByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "tags": [ + "Service" + ], + "description": "This method does all necessary pre-job creation validation under subscription.", + "operationId": "Service_ValidateInputs", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The validation status and responses of each validating parameter.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "ValidateInputs": { + "$ref": "./examples/ValidateInputs.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Lists all the jobs available under the given resource group.", + "operationId": "Jobs_ListByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "List of jobs by resource group.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "JobsListByResourceGroup": { + "$ref": "./examples/JobsListByResourceGroup.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "tags": [ + "Jobs" + ], + "description": "Gets information about the specified job.", + "operationId": "Jobs_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsGet": { + "$ref": "./examples/JobsGet.json" + }, + "JobsGetCmk": { + "$ref": "./examples/JobsGetCmk.json" + }, + "JobsGetExport": { + "$ref": "./examples/JobsGetExport.json" + }, + "JobsGetCopyStuck": { + "$ref": "./examples/JobsGetCopyStuck.json" + }, + "JobsGetWaitingForAction": { + "$ref": "./examples/JobsGetWaitingForAction.json" + } + } + }, + "put": { + "tags": [ + "Jobs" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "operationId": "Jobs_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for create Job." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsCreate": { + "$ref": "./examples/JobsCreate.json" + }, + "JobsCreateDevicePassword": { + "$ref": "./examples/JobsCreateDevicePassword.json" + }, + "JobsCreateExport": { + "$ref": "./examples/JobsCreateExport.json" + }, + "JobsCreateDoubleEncryption": { + "$ref": "./examples/JobsCreateDoubleEncryption.json" + }, + "JobsCreateWithUserAssignedIdentity": { + "$ref": "./examples/JobsCreateWithUserAssignedIdentity.json" + } + } + }, + "delete": { + "tags": [ + "Jobs" + ], + "description": "Deletes a job.", + "operationId": "Jobs_Delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Just for swagger we are adding this status code." + }, + "202": { + "description": "Accepted request for delete Job.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "204": { + "description": "Job deleted." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsDelete": { + "$ref": "./examples/JobsDelete.json" + } + } + }, + "patch": { + "tags": [ + "Jobs" + ], + "description": "Updates the properties of an existing job.", + "operationId": "Jobs_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Job object.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Accepted request for job updated.", + "headers": { + "Location": { + "description": "The URI to poll for completion status.", + "type": "string" + } + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "JobsPatch": { + "$ref": "./examples/JobsPatch.json" + }, + "JobsPatchCmk": { + "$ref": "./examples/JobsPatchCmk.json" + }, + "JobsPatchSystemAssignedToUserAssigned": { + "$ref": "./examples/JobsPatchSystemAssignedToUserAssigned.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "tags": [ + "Jobs" + ], + "description": "Book shipment pick up.", + "operationId": "Jobs_BookShipmentPickUp", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Booked shipment pick up successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "BookShipmentPickupPost": { + "$ref": "./examples/BookShipmentPickupPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "tags": [ + "Jobs" + ], + "description": "CancelJob.", + "operationId": "Jobs_Cancel", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "Job cancelled." + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "JobsCancelPost": { + "$ref": "./examples/JobsCancelPost.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "tags": [ + "Jobs" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "operationId": "Jobs_ListCredentials", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/jobNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "List of unencrypted credentials of the job.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "JobsListCredentials": { + "$ref": "./examples/JobsListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "operationId": "Service_RegionConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfiguration": { + "$ref": "./examples/RegionConfiguration.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "tags": [ + "Service" + ], + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "operationId": "Service_RegionConfigurationByResourceGroup", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Region configuration response.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "Error response describing reason for operation failure.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-examples": { + "RegionConfigurationByResourceGroup": { + "$ref": "./examples/RegionConfigurationByResourceGroup.json" + } + } + } + } + }, + "definitions": { + "AccountCredentialDetails": { + "description": "Credential details of the account.", + "type": "object", + "properties": { + "accountName": { + "description": "Name of the account.", + "type": "string", + "readOnly": true + }, + "dataAccountType": { + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountConnectionString": { + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "type": "string", + "readOnly": true + }, + "shareCredentialDetails": { + "description": "Per share level unencrypted access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "description": "This class represents additional info which Resource Providers pass when an error occurs.", + "properties": { + "info": { + "description": "Additional information of the type of error.", + "type": "object" + }, + "type": { + "description": "Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation).", + "type": "string" + } + }, + "type": "object" + }, + "AddressValidationOutput": { + "description": "Output of the address validation api.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "description": "The address validation output.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "validationStatus": { + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Address provided is valid." + }, + { + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "alternateAddresses": { + "description": "List of alternate addresses.", + "type": "array", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ApiError": { + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail" + } + } + }, + "ApplianceNetworkConfiguration": { + "description": "The Network Adapter configuration of a DataBox.", + "type": "object", + "properties": { + "name": { + "description": "Name of the network.", + "type": "string", + "readOnly": true + }, + "macAddress": { + "description": "Mac Address.", + "type": "string", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "description": "Base class for all objects under resource.", + "type": "object", + "properties": { + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "description": "The filters for showing the available skus.", + "required": [ + "transferType", + "country", + "location" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuNames": { + "description": "Sku Names to filter for available skus", + "type": "array", + "items": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + } + ] + } + } + } + } + }, + "AvailableSkusResult": { + "description": "The available skus operation response.", + "type": "object", + "properties": { + "value": { + "description": "List of available skus.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of skus.", + "type": "string" + } + } + }, + "AzureFileFilterDetails": { + "description": "Filter details to transfer Azure files", + "type": "object", + "properties": { + "filePrefixList": { + "description": "Prefix list of the Azure files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "filePathList": { + "description": "List of full path of the files to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "fileShareList": { + "description": "List of file shares to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "description": "Filter details to transfer Azure Blobs", + "type": "object", + "properties": { + "blobPrefixList": { + "description": "Prefix list of the Azure blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "blobPathList": { + "description": "List of full path of the blobs to be transferred.", + "type": "array", + "items": { + "type": "string" + } + }, + "containerList": { + "description": "List of blob containers to be transferred.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "description": "Reason for cancellation.", + "required": [ + "reason" + ], + "type": "object", + "properties": { + "reason": { + "description": "Reason for cancellation.", + "type": "string" + } + } + }, + "CloudError": { + "description": "Provides additional information about an http error response.", + "properties": { + "additionalInfo": { + "description": "Gets or sets additional error info.", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true, + "type": "array" + }, + "code": { + "description": "Error code.", + "type": "string" + }, + "details": { + "description": "Gets or sets details for the error.", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true, + "type": "array" + }, + "message": { + "description": "The error message parsed from the body of the http error response.", + "type": "string" + }, + "target": { + "description": "Gets or sets the target of the error.", + "type": "string" + } + }, + "type": "object" + }, + "ContactDetails": { + "description": "Contact Details.", + "required": [ + "contactName", + "phone", + "emailList" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + }, + "emailList": { + "description": "List of Email-ids to be notified about job progress.", + "type": "array", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "description": "Notification preference for a job stage.", + "type": "array", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + } + }, + "ContactInfo": { + "description": "Contact Info.", + "required": [ + "contactName", + "phone" + ], + "type": "object", + "properties": { + "contactName": { + "description": "Contact name of the person.", + "minLength": 1, + "type": "string" + }, + "phone": { + "description": "Phone number of the contact person.", + "minLength": 1, + "type": "string" + }, + "phoneExtension": { + "description": "Phone extension number of the contact person.", + "type": "string" + }, + "mobile": { + "description": "Mobile number of the contact person.", + "type": "string" + } + } + }, + "CopyLogDetails": { + "description": "Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "GranularCopyLogDetails": { + "description": "Granular Details for log generated during copy.", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "properties": { + "copyLogDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + } + }, + "discriminator": "copyLogDetailsType" + }, + "DataBoxCustomerDiskCopyProgress": { + "description": "DataBox CustomerDisk Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DeviceErasureDetails": { + "description": "Device erasure details with erasure completion status and erasureordestructionlog sas key", + "type": "object", + "properties": { + "deviceErasureStatus": { + "description": "Holds the device erasure completion status", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action for clean up." + } + ] + } + }, + "erasureOrDestructionCertificateSasKey": { + "description": "Shared access key to download cleanup or destruction certificate for device", + "type": "string", + "readOnly": true + } + } + }, + "CopyProgress": { + "description": "Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "GranularCopyProgress": { + "description": "Granular Copy progress.", + "type": "object", + "properties": { + "storageAccountName": { + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "type": "string", + "readOnly": true + }, + "transferType": { + "description": "Transfer type of data", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "dataAccountType": { + "description": "Data Account Type.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "accountId": { + "description": "Id of the account where the data needs to be uploaded.", + "type": "string", + "readOnly": true + }, + "bytesProcessed": { + "format": "int64", + "description": "To indicate bytes transferred.", + "type": "integer", + "readOnly": true + }, + "totalBytesToProcess": { + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "type": "integer", + "readOnly": true + }, + "filesProcessed": { + "format": "int64", + "description": "Number of files processed", + "type": "integer", + "readOnly": true + }, + "totalFilesToProcess": { + "format": "int64", + "description": "Total files to process", + "type": "integer", + "readOnly": true + }, + "invalidFilesProcessed": { + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "renamedContainerCount": { + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "type": "integer", + "readOnly": true + }, + "filesErroredOut": { + "format": "int64", + "description": "Number of files which could not be copied", + "type": "integer", + "readOnly": true + }, + "directoriesErroredOut": { + "format": "int64", + "description": "To indicate directories errored out in the job.", + "type": "integer", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "format": "int64", + "description": "To indicate directories renamed", + "type": "integer", + "readOnly": true + }, + "isEnumerationInProgress": { + "description": "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid.", + "type": "boolean", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "CreateJobValidations": { + "description": "It does all pre-job creation validations.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "description": "Request to validate create order limit for current subscription.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "model": { + "$ref": "#/definitions/ModelName" + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "description": "Properties of create order limit for subscription validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "DataBoxCustomerDiskJobDetails": { + "description": "Customer disk job details.", + "required": [ + "jobDetailsType", + "returnToCustomerPackageDetails" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "importDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for import jobs.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ImportDiskDetails" + } + }, + "exportDiskDetailsCollection": { + "description": "Contains the map of disk serial number to the disk details for export jobs.", + "type": "object", + "readOnly": true, + "additionalProperties": { + "$ref": "#/definitions/ExportDiskDetails" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxCustomerDiskCopyProgress" + }, + "readOnly": true + }, + "deliverToDcPackageDetails": { + "description": "Delivery package shipping details.", + "$ref": "#/definitions/PackageCarrierInfo", + "readOnly": true + }, + "returnToCustomerPackageDetails": { + "description": "Return package shipping details.", + "$ref": "#/definitions/PackageCarrierDetails" + }, + "enableManifestBackup": { + "description": "Flag to indicate if disk manifest should be backed-up in the Storage Account.", + "type": "boolean", + "default": false + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "CustomerDiskJobSecrets": { + "description": "The secrets related to customer disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "carrierAccountNumber": { + "description": "Carrier Account Number of the customer", + "type": "string", + "readOnly": true, + "x-ms-secret": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataAccountDetails": { + "description": "Account details of the data to be transferred", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Account Type of the data to be transferred.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "sharePassword": { + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string", + "x-ms-secret": true, + "x-ms-mutability": [ + "create" + ] + } + }, + "discriminator": "dataAccountType" + }, + "DatacenterAddressInstructionResponse": { + "description": "Datacenter instruction for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "communicationInstruction": { + "description": "Data center communication instruction", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressInstruction" + }, + "DatacenterAddressLocationResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "properties": { + "contactPersonName": { + "description": "Contact person name", + "type": "string", + "readOnly": true + }, + "company": { + "description": "Company name", + "type": "string", + "readOnly": true + }, + "street1": { + "description": "Street address line 1", + "type": "string", + "readOnly": true + }, + "street2": { + "description": "Street address line 2", + "type": "string", + "readOnly": true + }, + "street3": { + "description": "Street address line 3", + "type": "string", + "readOnly": true + }, + "city": { + "description": "City name", + "type": "string", + "readOnly": true + }, + "state": { + "description": "name of the state", + "type": "string", + "readOnly": true + }, + "zip": { + "description": "Zip code", + "type": "string", + "readOnly": true + }, + "country": { + "description": "name of the country", + "type": "string", + "readOnly": true + }, + "phone": { + "description": "Phone number", + "type": "string", + "readOnly": true + }, + "phoneExtension": { + "description": "Phone extension", + "type": "string", + "readOnly": true + }, + "addressType": { + "description": "Address type", + "type": "string", + "readOnly": true + }, + "additionalShippingInformation": { + "description": "Special instruction for shipping", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DatacenterAddressLocation" + }, + "DatacenterAddressRequest": { + "description": "Request body to get the datacenter address.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the data center address requested.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "model": { + "$ref": "#/definitions/ModelName" + } + } + }, + "DatacenterAddressResponse": { + "description": "Datacenter address for given storage location.", + "required": [ + "datacenterAddressType" + ], + "type": "object", + "properties": { + "datacenterAddressType": { + "description": "Data center address type", + "enum": [ + "DatacenterAddressLocation", + "DatacenterAddressInstruction" + ], + "type": "string", + "x-ms-enum": { + "name": "DatacenterAddressType", + "modelAsExtensible": false, + "values": [ + { + "value": "DatacenterAddressLocation", + "description": "Data center address location." + }, + { + "value": "DatacenterAddressInstruction", + "description": "Data center address instruction." + } + ] + } + }, + "supportedCarriersForReturnShipment": { + "description": "List of supported carriers for return shipment.", + "uniqueItems": false, + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "dataCenterAzureLocation": { + "description": "Azure Location where the Data Center serves primarily.", + "type": "string", + "readOnly": true + } + }, + "discriminator": "datacenterAddressType" + }, + "DataBoxAccountCopyLogDetails": { + "description": "Copy log details for a storage account of a DataBox job", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "string", + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxCustomerDiskCopyLogDetails": { + "description": "Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyLogDetails": { + "description": "Copy Log Details for a disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "diskSerialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskGranularCopyLogDetails": { + "description": "Granular Copy Log Details for customer disk", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyLogDetails" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "accountId": { + "description": "Account id.", + "type": "string", + "readOnly": true + }, + "errorLogLink": { + "description": "Link for copy error logs.", + "type": "string", + "readOnly": true + }, + "verboseLogLink": { + "description": "Link for copy verbose logs.", + "type": "string", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyProgress": { + "description": "DataBox Disk Copy Progress", + "type": "object", + "properties": { + "serialNumber": { + "description": "The serial number of the disk", + "type": "string", + "readOnly": true + }, + "bytesCopied": { + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "type": "integer", + "readOnly": true + }, + "percentComplete": { + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "type": "integer", + "readOnly": true + }, + "status": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + } + } + }, + "DataBoxDiskGranularCopyProgress": { + "description": "DataBox Disk Granular Copy Progress", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/GranularCopyProgress" + } + ], + "properties": { + "serialNumber": { + "description": "Disk Serial Number.", + "type": "string", + "readOnly": true + }, + "copyStatus": { + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "value": "Completed", + "description": "Data copy completed." + }, + { + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + } + } + }, + "DataBoxDiskJobDetails": { + "description": "DataBox Disk Job Details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "preferredDisks": { + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "granularCopyProgress": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyProgress" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "granularCopyLogDetails": { + "description": "Copy progress per disk.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyLogDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "disksAndSizeDetails": { + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "description": "User entered passkey for DataBox Disk job.", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "description": "The secrets related to disk job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "diskSecrets": { + "description": "Contains the list of secrets object for that device.", + "type": "array", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "description": "PassKey for the disk Job.", + "type": "string", + "readOnly": true + }, + "isPasskeyUserDefined": { + "description": "Whether passkey was provided by user.", + "type": "boolean", + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "description": "Copy log details for a storage account for Databox heavy", + "required": [ + "copyLogDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "properties": { + "accountName": { + "description": "Account name.", + "type": "string", + "readOnly": true + }, + "copyLogLink": { + "description": "Link for copy logs.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "description": "Databox Heavy Device Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "description": "The secrets related to a databox heavy job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "cabinetPodSecrets": { + "description": "Contains the list of secret objects for a databox heavy job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "description": "The secrets related to a databox heavy.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "description": "Databox Job Details", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "properties": { + "copyProgress": { + "description": "Copy progress per storage account.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "type": "string" + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataboxJobSecrets": { + "description": "The secrets related to a databox job.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "properties": { + "podSecrets": { + "description": "Contains the list of secret objects for a job.", + "type": "array", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling data box orders orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "description": "The secrets related to a DataBox.", + "type": "object", + "properties": { + "deviceSerialNumber": { + "description": "Serial number of the assigned device.", + "type": "string", + "readOnly": true + }, + "devicePassword": { + "description": "Password for out of the box experience on device.", + "type": "string", + "readOnly": true + }, + "networkConfigurations": { + "description": "Network configuration of the appliance.", + "type": "array", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "description": "The base 64 encoded public key to authenticate with the device", + "type": "string", + "readOnly": true + }, + "accountCredentialDetails": { + "description": "Per account level access credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataExportDetails": { + "description": "Details of the data to be used for exporting data from azure.", + "required": [ + "transferConfiguration", + "accountDetails" + ], + "type": "object", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + } + }, + "DataImportDetails": { + "description": "Details of the data to be used for importing data to azure.", + "required": [ + "accountDetails" + ], + "type": "object", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + }, + "logCollectionLevel": { + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "type": "string", + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsExtensible": true, + "values": [ + { + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + }, + "default": "Error" + } + } + }, + "DataLocationToServiceLocationMap": { + "description": "Map of data location to service location", + "type": "object", + "properties": { + "dataLocation": { + "description": "Location of the data.", + "type": "string", + "readOnly": true + }, + "serviceLocation": { + "description": "Location of the service.", + "type": "string", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "description": "Request to validate export and import data details.", + "required": [ + "deviceType", + "transferType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "dataExportDetails": { + "description": "List of DataTransfer details to be used to export data from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "description": "List of DataTransfer details to be used to import data to azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "description": "Device type.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "model": { + "$ref": "#/definitions/ModelName" + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "description": "Properties of data transfer details validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Data transfer details validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DcAccessSecurityCode": { + "description": "Dc access security code", + "type": "object", + "properties": { + "reverseDCAccessCode": { + "description": "Reverse Dc access security code.", + "type": "string" + }, + "forwardDCAccessCode": { + "description": "Forward Dc access security code.", + "type": "string" + } + } + }, + "Details": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "DeviceCapabilityDetails": { + "description": "Device capability details for a given sku for a given region.", + "type": "object", + "properties": { + "hardwareEncryption": { + "description": "Hardware encryption support for a given sku for a given region.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "HardwareEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Hardware-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Hardware-based encryption is disabled." + } + ] + } + } + } + }, + "DeviceCapabilityRequest": { + "description": "Request body to get the device capabilities for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "model": { + "$ref": "#/definitions/ModelName" + } + } + }, + "DeviceCapabilityResponse": { + "description": "Device capabilities for given sku in a region", + "type": "object", + "properties": { + "deviceCapabilityDetails": { + "description": "List of device capabilities available for a given region and a given sku", + "type": "array", + "items": { + "$ref": "#/definitions/DeviceCapabilityDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + } + } + }, + "DiskScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling disk orders.", + "required": [ + "storageLocation", + "skuName", + "expectedDataSizeInTeraBytes" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": { + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + } + }, + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "description": "Contains all the secrets of a Disk.", + "type": "object", + "properties": { + "diskSerialNumber": { + "description": "Serial number of the assigned disk.", + "type": "string", + "readOnly": true + }, + "bitLockerKey": { + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "type": "string", + "readOnly": true + } + } + }, + "EncryptionPreferences": { + "description": "Preferences related to the Encryption.", + "type": "object", + "properties": { + "doubleEncryption": { + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + }, + "default": "Disabled" + }, + "hardwareEncryption": { + "description": "Defines Hardware level encryption (Only for disk)", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "HardwareEncryption", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Hardware-based encryption is enabled." + }, + { + "value": "Disabled", + "description": "Hardware-based encryption is enabled." + } + ] + } + } + } + }, + "ErrorDetail": { + "required": [ + "code", + "message" + ], + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string" + } + } + }, + "ExportDiskDetails": { + "description": "Export disk details", + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string", + "readOnly": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "FilterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "required": [ + "filterFileType", + "filterFilePath" + ], + "type": "object", + "properties": { + "filterFileType": { + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "type": "string", + "x-ms-enum": { + "name": "FilterFileType", + "modelAsExtensible": true, + "values": [ + { + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "filterFilePath": { + "description": "Path of the file that contains the details of all items to transfer.", + "type": "string" + } + } + }, + "HeavyScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling heavy orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "description": "Managed identity properties.", + "type": "object", + "properties": { + "type": { + "description": "Managed service identity type.", + "type": "string" + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "ImportDiskDetails": { + "description": "Import disk details", + "required": [ + "manifestFile", + "manifestHash", + "bitLockerKey" + ], + "type": "object", + "properties": { + "manifestFile": { + "description": "The relative path of the manifest file on the disk.", + "type": "string" + }, + "manifestHash": { + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "type": "string" + }, + "bitLockerKey": { + "description": "BitLocker key used to encrypt the disk.", + "type": "string", + "x-ms-secret": true + }, + "backupManifestCloudPath": { + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "type": "string", + "readOnly": true + } + } + }, + "JobDeliveryInfo": { + "description": "Additional delivery info.", + "type": "object", + "properties": { + "scheduledDateTime": { + "format": "date-time", + "description": "Scheduled date time.", + "type": "string" + } + } + }, + "JobDelayDetails": { + "description": "Job Delay Notification details", + "type": "object", + "properties": { + "status": { + "description": "Status of notification", + "enum": [ + "Active", + "Resolved" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DelayNotificationStatus", + "modelAsString": true, + "values": [ + { + "value": "Active", + "description": "Delay is still active" + }, + { + "value": "Resolved", + "description": "Delay has been resolved" + } + ] + } + }, + "errorCode": { + "description": "Delay Error code", + "enum": [ + "InternalIssueDelay", + "ActiveOrderLimitBreachedDelay", + "HighDemandDelay", + "LargeNumberOfFilesDelay" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "PortalDelayErrorCode", + "modelAsString": true, + "values": [ + { + "value": "InternalIssueDelay", + "description": "Delay due to any internal reasons" + }, + { + "value": "ActiveOrderLimitBreachedDelay", + "description": "Active Order limit breached." + }, + { + "value": "HighDemandDelay", + "description": "High demand" + }, + { + "value": "LargeNumberOfFilesDelay", + "description": "Slow copy due to large number of files" + } + ] + } + }, + "description": { + "description": "Description of the delay.", + "type": "string", + "readOnly": true + }, + "startTime": { + "format": "date-time", + "description": "Timestamp when the delay notification was created.", + "type": "string", + "readOnly": true + }, + "resolutionTime": { + "format": "date-time", + "description": "Timestamp when the delay notification was resolved.", + "type": "string", + "readOnly": true + } + } + }, + "JobDetails": { + "description": "Job details.", + "required": [ + "contactDetails", + "jobDetailsType" + ], + "type": "object", + "properties": { + "jobStages": { + "description": "List of stages that run in the job.", + "type": "array", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "description": "Details of the data to be imported into azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "description": "Details of the data to be exported from azure.", + "type": "array", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails", + "description": "Optional Reverse Shipping details for order." + }, + "copyLogDetails": { + "description": "List of copy log details.", + "type": "array", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "description": "Shared access key to download the return shipment label", + "type": "string", + "readOnly": true + }, + "chainOfCustodySasKey": { + "description": "Shared access key to download the chain of custody logs", + "type": "string", + "readOnly": true + }, + "deviceErasureDetails": { + "$ref": "#/definitions/DeviceErasureDetails", + "description": "Holds device data erasure details", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes.", + "type": "integer" + }, + "actions": { + "description": "Available actions on the job.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + }, + "datacenterAddress": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address to ship to, for the given sku and storage location.", + "readOnly": true + }, + "dataCenterCode": { + "description": "DataCenter code.", + "enum": [ + "Invalid", + "BY2", + "BY1", + "ORK70", + "AM2", + "AMS20", + "BY21", + "BY24", + "MWH01", + "AMS06", + "SSE90", + "SYD03", + "SYD23", + "CBR20", + "YTO20", + "CWL20", + "LON24", + "BOM01", + "BL20", + "BL7", + "SEL20", + "TYO01", + "BN1", + "SN5", + "CYS04", + "TYO22", + "YTO21", + "YQB20", + "FRA22", + "MAA01", + "CPQ02", + "CPQ20", + "SIN20", + "HKG20", + "SG2", + "MEL23", + "SEL21", + "OSA20", + "SHA03", + "BJB", + "JNB22", + "JNB21", + "MNZ21", + "SN8", + "AUH20", + "ZRH20", + "PUS20", + "AdHoc", + "CH1", + "DSM05", + "DUB07", + "PNQ01", + "SVG20", + "OSA02", + "OSA22", + "PAR22", + "BN7", + "SN6", + "BJS20", + "BL24", + "IDC5", + "TYO23", + "NTG20", + "DXB23", + "DSM11", + "AMS25", + "CPQ21", + "OSA23" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "DataCenterCode", + "modelAsString": true, + "values": [ + { + "value": "Invalid" + }, + { + "value": "BY2" + }, + { + "value": "BY1" + }, + { + "value": "ORK70" + }, + { + "value": "AM2" + }, + { + "value": "AMS20" + }, + { + "value": "BY21" + }, + { + "value": "BY24" + }, + { + "value": "MWH01" + }, + { + "value": "AMS06" + }, + { + "value": "SSE90" + }, + { + "value": "SYD03" + }, + { + "value": "SYD23" + }, + { + "value": "CBR20" + }, + { + "value": "YTO20" + }, + { + "value": "CWL20" + }, + { + "value": "LON24" + }, + { + "value": "BOM01" + }, + { + "value": "BL20" + }, + { + "value": "BL7" + }, + { + "value": "SEL20" + }, + { + "value": "TYO01" + }, + { + "value": "BN1" + }, + { + "value": "SN5" + }, + { + "value": "CYS04" + }, + { + "value": "TYO22" + }, + { + "value": "YTO21" + }, + { + "value": "YQB20" + }, + { + "value": "FRA22" + }, + { + "value": "MAA01" + }, + { + "value": "CPQ02" + }, + { + "value": "CPQ20" + }, + { + "value": "SIN20" + }, + { + "value": "HKG20" + }, + { + "value": "SG2" + }, + { + "value": "MEL23" + }, + { + "value": "SEL21" + }, + { + "value": "OSA20" + }, + { + "value": "SHA03" + }, + { + "value": "BJB" + }, + { + "value": "JNB22" + }, + { + "value": "JNB21" + }, + { + "value": "MNZ21" + }, + { + "value": "SN8" + }, + { + "value": "AUH20" + }, + { + "value": "ZRH20" + }, + { + "value": "PUS20" + }, + { + "value": "AdHoc" + }, + { + "value": "CH1" + }, + { + "value": "DSM05" + }, + { + "value": "DUB07" + }, + { + "value": "PNQ01" + }, + { + "value": "SVG20" + }, + { + "value": "OSA02" + }, + { + "value": "OSA22" + }, + { + "value": "PAR22" + }, + { + "value": "BN7" + }, + { + "value": "SN6" + }, + { + "value": "BJS20" + }, + { + "value": "BL24" + }, + { + "value": "IDC5" + }, + { + "value": "TYO23" + }, + { + "value": "CPQ21" + }, + { + "value": "NTG20" + }, + { + "value": "DXB23" + }, + { + "value": "DSM11" + }, + { + "value": "OSA23" + }, + { + "value": "AMS25" + } + ] + } + } + }, + "discriminator": "jobDetailsType" + }, + "JobProperties": { + "description": "Job Properties", + "required": [ + "transferType" + ], + "type": "object", + "properties": { + "transferType": { + "description": "Type of the data transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "isCancellable": { + "description": "Describes whether the job is cancellable or not.", + "type": "boolean", + "readOnly": true + }, + "isDeletable": { + "description": "Describes whether the job is deletable or not.", + "type": "boolean", + "readOnly": true + }, + "isShippingAddressEditable": { + "description": "Describes whether the shipping address is editable or not.", + "type": "boolean", + "readOnly": true + }, + "reverseShippingDetailsUpdate": { + "description": "The Editable status for Reverse Shipping Address and Contact Info", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseShippingDetailsEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse shipping details can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse shipping details." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse shipping details. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "reverseTransportPreferenceUpdate": { + "description": "The Editable status for Reverse Transport preferences", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ReverseTransportPreferenceEditStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Enabled", + "description": "Reverse Transport Preferences can be edited." + }, + { + "value": "Disabled", + "description": "Edit is disabled for Reverse Transport Preferences." + }, + { + "value": "NotSupported", + "description": "Edit is not supported for Reverse Transport Preferences. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "isPrepareToShipEnabled": { + "description": "Is Prepare To Ship Enabled on this job", + "type": "boolean", + "readOnly": true + }, + "status": { + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "delayedStage": { + "description": "Name of the stage where delay might be present.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "startTime": { + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "description": "Reason for cancellation.", + "type": "string", + "readOnly": true + }, + "deliveryType": { + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "type": "string", + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsExtensible": true, + "values": [ + { + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "value": "Scheduled", + "description": "Scheduled job." + } + ] + }, + "default": "NonScheduled" + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "description": "Flag to indicate cancellation of scheduled job.", + "type": "boolean", + "readOnly": true + }, + "allDevicesLost": { + "description": "Flag to indicate if all devices associated with the job are lost.", + "type": "boolean", + "readOnly": true + } + } + }, + "JobResource": { + "description": "Job Resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "name": { + "description": "Name of the object.", + "type": "string", + "readOnly": true + }, + "id": { + "description": "Id of the object.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "Type of the object.", + "type": "string", + "readOnly": true + }, + "systemData": { + "$ref": "#/definitions/systemData", + "description": "Metadata pertaining to creation and last modification of the resource.", + "readOnly": true + } + } + }, + "JobResourceList": { + "description": "Job Resource Collection", + "type": "object", + "properties": { + "value": { + "description": "List of job resources.", + "type": "array", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "description": "Link for the next set of job resources.", + "type": "string" + } + } + }, + "JobResourceUpdateParameter": { + "description": "The JobResourceUpdateParameter.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "description": "The base class for the secrets", + "required": [ + "jobSecretsType" + ], + "type": "object", + "properties": { + "jobSecretsType": { + "description": "Used to indicate what type of job secrets object.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsExtensible": false, + "values": [ + { + "value": "DataBox", + "description": "Data Box orders." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType" + }, + "JobStages": { + "description": "Job stages.", + "type": "object", + "properties": { + "stageName": { + "description": "Name of the job stage.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "value": "Completed", + "description": "Order has completed." + }, + { + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "value": "Created", + "description": "Job created by the customer." + }, + { + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "displayName": { + "description": "Display name of the job stage.", + "type": "string", + "readOnly": true + }, + "stageStatus": { + "description": "Status of the job stage.", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "StageStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No status available yet." + }, + { + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "value": "Failed", + "description": "Stage has failed." + }, + { + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action." + } + ] + } + }, + "stageTime": { + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "type": "string", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "type": "object", + "readOnly": true + }, + "delayInformation": { + "description": "Delay information for the job stages.", + "type": "array", + "items": { + "$ref": "#/definitions/JobDelayDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + } + } + }, + "KeyEncryptionKey": { + "description": "Encryption key containing details about key to encrypt different keys.", + "required": [ + "kekType" + ], + "type": "object", + "properties": { + "kekType": { + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "KekType", + "modelAsExtensible": true, + "values": [ + { + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + }, + "default": "MicrosoftManaged" + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "description": "Key encryption key. It is required in case of Customer managed KekType.", + "type": "string" + }, + "kekVaultResourceID": { + "description": "Kek vault resource id. It is required in case of Customer managed KekType.", + "type": "string" + } + } + }, + "ManagedDiskDetails": { + "description": "Details of the managed disks.", + "required": [ + "resourceGroupId", + "stagingStorageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "resourceGroupId": { + "description": "Resource Group Id of the compute disks.", + "type": "string" + }, + "stagingStorageAccountId": { + "description": "Resource Id of the storage account that can be used to copy the vhd for staging.", + "type": "string" + } + }, + "x-ms-discriminator-value": "ManagedDisk" + }, + "MarkDevicesShippedRequest": { + "description": "The request body to provide the delivery package details of job", + "required": [ + "deliverToDcPackageDetails" + ], + "type": "object", + "properties": { + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package details" + } + } + }, + "LastMitigationActionOnJob": { + "description": "Last Mitigation Action Performed On Job", + "type": "object", + "properties": { + "actionDateTimeInUtc": { + "format": "date-time", + "description": "Action performed date time", + "type": "string" + }, + "isPerformedByCustomer": { + "description": "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops", + "type": "boolean" + }, + "customerResolution": { + "description": "Resolution code provided by customer", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + } + } + }, + "MitigateJobRequest": { + "description": "The Mitigate Job captured from request body for Mitigate API", + "type": "object", + "properties": { + "customerResolutionCode": { + "description": "Resolution code for the job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "description": "Restart whole action.", + "value": "Restart" + }, + { + "description": "Reach out to operation for further action.", + "value": "ReachOutToOperation" + } + ] + } + }, + "serialNumberCustomerResolutionMap": { + "description": "Serial number and the customer resolution code corresponding to each serial number", + "type": "object", + "additionalProperties": { + "format": "int32", + "description": "Available customer resolution codes on a job", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "No Resolution Yet" + }, + { + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "value": "Resume", + "description": "Resume the job" + }, + { + "value": "Restart", + "description": "Restart whole action" + }, + { + "value": "ReachOutToOperation", + "description": "Reach out to operation for further action" + } + ] + } + } + } + } + }, + "NotificationPreference": { + "description": "Notification preference for a job stage.", + "required": [ + "stageName", + "sendNotification" + ], + "type": "object", + "properties": { + "stageName": { + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Created", + "ShippedToCustomer" + ], + "type": "string", + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsString": true, + "values": [ + { + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "value": "DataCopy", + "description": "Notification at data copy started stage." + }, + { + "value": "Created", + "description": "Notification at job created stage." + }, + { + "value": "ShippedToCustomer", + "description": "Notification at shipped devices to customer stage." + } + ] + } + }, + "sendNotification": { + "description": "Notification is required or not.", + "type": "boolean", + "default": true + } + } + }, + "Operation": { + "description": "Operation entity.", + "type": "object", + "properties": { + "name": { + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "type": "string", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "description": "Origin of the operation. Can be : user|system|user,system", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Indicates whether the operation is a data action", + "type": "boolean" + } + } + }, + "OperationDisplay": { + "description": "Operation display", + "type": "object", + "properties": { + "provider": { + "description": "Provider name.", + "type": "string" + }, + "resource": { + "description": "Resource name.", + "type": "string" + }, + "operation": { + "description": "Localized name of the operation for display purpose.", + "type": "string" + }, + "description": { + "description": "Localized description of the operation for display purpose.", + "type": "string" + } + } + }, + "OperationList": { + "description": "Operation Collection.", + "type": "object", + "properties": { + "value": { + "description": "List of operations.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "description": "Link for the next set of operations.", + "type": "string" + } + } + }, + "OperationProperties": { + "description": "Operation properties.", + "type": "object", + "properties": {} + }, + "PackageCarrierDetails": { + "description": "Package carrier details.", + "type": "object", + "properties": { + "carrierAccountNumber": { + "description": "Carrier Account Number of customer for customer disk.", + "type": "string", + "x-ms-secret": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageCarrierInfo": { + "description": "package carrier info", + "type": "object", + "properties": { + "carrierName": { + "description": "Name of the carrier.", + "type": "string" + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string" + } + } + }, + "PackageShippingDetails": { + "description": "package shipping details", + "type": "object", + "properties": { + "trackingUrl": { + "description": "Url where shipment can be tracked.", + "type": "string", + "readOnly": true + }, + "carrierName": { + "description": "Name of the carrier.", + "type": "string", + "readOnly": true + }, + "trackingId": { + "description": "Tracking Id of shipment.", + "type": "string", + "readOnly": true + } + } + }, + "Preferences": { + "description": "Preferences related to the order", + "type": "object", + "properties": { + "preferredDataCenterRegion": { + "description": "Preferred data center region.", + "type": "array", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "reverseTransportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Optional Preferences related to the reverse shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + }, + "storageAccountAccessTierPreferences": { + "description": "Preferences related to the Access Tier of storage accounts.", + "uniqueItems": false, + "type": "array", + "items": { + "enum": [ + "Archive" + ], + "type": "string", + "x-ms-enum": { + "name": "StorageAccountAccessTier", + "modelAsExtensible": true, + "values": [ + { + "value": "Archive", + "description": "Archive Access Tier shares requested by the customer." + } + ] + } + } + } + } + }, + "PreferencesValidationRequest": { + "description": "Request to validate preference of transport and data center.", + "required": [ + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "preference": { + "description": "Preference of transport and data center.", + "$ref": "#/definitions/Preferences" + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "model": { + "$ref": "#/definitions/ModelName" + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "description": "Properties of data center and transport preference validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of requested data center and transport.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "description": "Request body to get the configuration for the region.", + "type": "object", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + }, + "datacenterAddressRequest": { + "$ref": "#/definitions/DatacenterAddressRequest", + "description": "Request body to get the datacenter address for given sku." + }, + "deviceCapabilityRequest": { + "$ref": "#/definitions/DeviceCapabilityRequest", + "description": "Request body to get the device capabilities for a given sku." + } + } + }, + "RegionConfigurationResponse": { + "description": "Configuration response specific to a region.", + "type": "object", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + }, + "datacenterAddressResponse": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address for given sku in a region.", + "readOnly": true + }, + "deviceCapabilityResponse": { + "$ref": "#/definitions/DeviceCapabilityResponse", + "description": "Device capabilities available for a given sku in a region.", + "readOnly": true + } + } + }, + "Resource": { + "description": "Model of the Resource.", + "required": [ + "location", + "sku" + ], + "type": "object", + "properties": { + "location": { + "description": "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed.", + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "tags": { + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "x-ms-azure-resource": true + }, + "ResourceIdentity": { + "description": "Msi identity details of the resource", + "type": "object", + "properties": { + "type": { + "description": "Identity type", + "type": "string", + "default": "None" + }, + "principalId": { + "description": "Service Principal Id backing the Msi", + "type": "string", + "readOnly": true + }, + "tenantId": { + "description": "Home Tenant Id", + "type": "string", + "readOnly": true + }, + "userAssignedIdentities": { + "description": "User Assigned Identities", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "ReverseShippingDetails": { + "description": "Reverse Shipping Address and contact details for a job.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactInfo" + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress" + }, + "isUpdated": { + "description": "A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared.\r\nRead only field", + "type": "boolean", + "readOnly": true + } + } + }, + "ScheduleAvailabilityRequest": { + "description": "Request body to get the availability for scheduling orders.", + "required": [ + "storageLocation", + "skuName" + ], + "type": "object", + "properties": { + "storageLocation": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "skuName": { + "description": "Sku Name for which the order is to be scheduled.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "country": { + "description": "Country in which storage location should be supported.", + "type": "string" + }, + "model": { + "$ref": "#/definitions/ModelName" + } + }, + "discriminator": "skuName" + }, + "ScheduleAvailabilityResponse": { + "description": "Schedule availability for given sku in a region.", + "type": "object", + "properties": { + "availableDates": { + "description": "List of dates available to schedule", + "type": "array", + "items": { + "format": "date-time", + "type": "string" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "description": "Credential details of the shares in account.", + "type": "object", + "properties": { + "shareName": { + "description": "Name of the share.", + "type": "string", + "readOnly": true + }, + "shareType": { + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsExtensible": true, + "values": [ + { + "value": "UnknownType", + "description": "Unknown format." + }, + { + "value": "HCS", + "description": "Storsimple data format." + }, + { + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "userName": { + "description": "User name for the share.", + "type": "string", + "readOnly": true + }, + "password": { + "description": "Password for the share.", + "type": "string", + "readOnly": true + }, + "supportedAccessProtocols": { + "description": "Access protocols supported on the device.", + "type": "array", + "items": { + "enum": [ + "SMB", + "NFS" + ], + "type": "string", + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsExtensible": true, + "values": [ + { + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "readOnly": true + } + } + }, + "ShipmentPickUpRequest": { + "description": "Shipment pick up request details.", + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ], + "type": "object", + "properties": { + "startTime": { + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "endTime": { + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area.", + "type": "string" + }, + "shipmentLocation": { + "description": "Shipment Location in the pickup place. Eg.front desk", + "type": "string" + } + } + }, + "ShipmentPickUpResponse": { + "description": "Shipment pick up response.", + "type": "object", + "properties": { + "confirmationNumber": { + "description": "Confirmation number for the pick up request.", + "type": "string", + "readOnly": true + }, + "readyByTime": { + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "type": "string", + "readOnly": true + } + } + }, + "ShippingAddress": { + "description": "Shipping address where customer wishes to receive the device.", + "required": [ + "streetAddress1", + "country" + ], + "type": "object", + "properties": { + "streetAddress1": { + "description": "Street Address line 1.", + "type": "string" + }, + "streetAddress2": { + "description": "Street Address line 2.", + "type": "string" + }, + "streetAddress3": { + "description": "Street Address line 3.", + "type": "string" + }, + "city": { + "description": "Name of the City.", + "type": "string" + }, + "stateOrProvince": { + "description": "Name of the State or Province.", + "type": "string" + }, + "country": { + "description": "Name of the Country.", + "type": "string" + }, + "postalCode": { + "description": "Postal code.", + "type": "string" + }, + "zipExtendedCode": { + "description": "Extended Zip Code.", + "type": "string" + }, + "companyName": { + "description": "Name of the company.", + "type": "string" + }, + "addressType": { + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "type": "string", + "x-ms-enum": { + "name": "AddressType", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "Address type not known." + }, + { + "value": "Residential", + "description": "Residential Address." + }, + { + "value": "Commercial", + "description": "Commercial Address." + } + ] + }, + "default": "None" + }, + "skipAddressValidation": { + "type": "boolean", + "description": "Flag to indicate if customer has chosen to skip default address validation" + }, + "taxIdentificationNumber": { + "type": "string", + "description": "Tax Identification Number" + } + } + }, + "Sku": { + "description": "The Sku.", + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "description": "The sku name.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "displayName": { + "description": "The display name of the sku.", + "type": "string" + }, + "family": { + "description": "The sku family.", + "type": "string" + }, + "model": { + "$ref": "#/definitions/ModelName" + } + } + }, + "SkuAvailabilityValidationRequest": { + "description": "Request to validate sku availability.", + "required": [ + "deviceType", + "transferType", + "country", + "location", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transferType": { + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferType", + "modelAsExtensible": true, + "values": [ + { + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "country": { + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "type": "string" + }, + "location": { + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + "type": "string" + }, + "model": { + "$ref": "#/definitions/ModelName" + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "description": "Properties of sku availability validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Sku availability validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "description": "Capacity of the sku.", + "type": "object", + "properties": { + "usable": { + "description": "Usable capacity in TB.", + "type": "string", + "readOnly": true + }, + "maximum": { + "description": "Maximum capacity in TB.", + "type": "string", + "readOnly": true + }, + "individualSkuUsable": { + "type": "string", + "description": "Maximum capacity per device in TB.", + "readOnly": true + } + } + }, + "SkuCost": { + "description": "Describes metadata for retrieving price info.", + "type": "object", + "properties": { + "meterId": { + "description": "Meter id of the Sku.", + "type": "string", + "readOnly": true + }, + "meterType": { + "description": "The type of the meter.", + "type": "string", + "readOnly": true + }, + "multiplier": { + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "type": "number", + "readOnly": true + } + } + }, + "SkuInformation": { + "description": "Information of the sku.", + "type": "object", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "description": "The sku is enabled or not.", + "type": "boolean", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuProperties": { + "description": "Properties of the sku.", + "type": "object", + "properties": { + "dataLocationToServiceLocationMap": { + "description": "The map of data location to service location.", + "type": "array", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "description": "Cost of the Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "description": "Api versions that support this Sku.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsExtensible": true, + "values": [ + { + "value": "None", + "description": "SKU is not disabled." + }, + { + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "disabledReasonMessage": { + "description": "Message for why the Sku is disabled.", + "type": "string", + "readOnly": true + }, + "requiredFeature": { + "description": "Required feature to access the sku.", + "type": "string", + "readOnly": true + }, + "countriesWithinCommerceBoundary": { + "description": "List of all the Countries in the SKU specific commerce boundary", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + } + } + }, + "StorageAccountDetails": { + "description": "Details for the storage account.", + "required": [ + "storageAccountId", + "dataAccountType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "properties": { + "storageAccountId": { + "description": "Storage Account Resource Id.", + "type": "string" + } + }, + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "description": "Request to validate subscription permission to create jobs.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": {}, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "description": "Properties of subscription permission to create job validation response.", + "required": [ + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "properties": { + "status": { + "description": "Validation status of subscription permission to create job.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "Valid", + "description": "Validation is successful" + }, + { + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "systemData": { + "description": "Provides details about resource creation and update time", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC)", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: user, application, managedIdentity", + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)", + "type": "string", + "readOnly": true + } + } + }, + "TransferAllDetails": { + "description": "Details to transfer all data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "transferAllBlobs": { + "description": "To indicate if all Azure blobs have to be transferred", + "type": "boolean" + }, + "transferAllFiles": { + "description": "To indicate if all Azure Files have to be transferred", + "type": "boolean" + } + } + }, + "TransferConfiguration": { + "description": "Configuration for defining the transfer of data.", + "required": [ + "transferConfigurationType" + ], + "type": "object", + "properties": { + "transferConfigurationType": { + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsExtensible": true, + "values": [ + { + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "transferFilterDetails": { + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "type": "object", + "properties": { + "include": { + "description": "Details of the filtering the transfer of data.", + "$ref": "#/definitions/TransferFilterDetails" + } + } + }, + "transferAllDetails": { + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "type": "object", + "properties": { + "include": { + "description": "Details to transfer all data.", + "$ref": "#/definitions/TransferAllDetails" + } + } + } + } + }, + "TransferFilterDetails": { + "description": "Details of the filtering the transfer of data.", + "required": [ + "dataAccountType" + ], + "type": "object", + "properties": { + "dataAccountType": { + "description": "Type of the account of data.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "DataAccountType", + "modelAsExtensible": true, + "values": [ + { + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + }, + "default": "StorageAccount" + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "description": "Details of the filter files to be used for data transfer.", + "type": "array", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + } + }, + "TransportAvailabilityDetails": { + "description": "Transport options availability details for given region.", + "type": "object", + "properties": { + "shipmentType": { + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + } + } + }, + "TransportAvailabilityRequest": { + "description": "Request body to get the transport availability for given sku.", + "type": "object", + "properties": { + "skuName": { + "description": "Type of the device.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "model": { + "$ref": "#/definitions/ModelName" + } + } + }, + "TransportAvailabilityResponse": { + "description": "Transport options available for given sku in a region.", + "type": "object", + "properties": { + "transportAvailabilityDetails": { + "description": "List of transport availability details for given region", + "type": "array", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "description": "Preferences related to the shipment logistics of the sku", + "required": [ + "preferredShipmentType" + ], + "type": "object", + "properties": { + "preferredShipmentType": { + "description": "Indicates Shipment Logistics type that the customer preferred.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsExtensible": true, + "values": [ + { + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + }, + "isUpdated": { + "description": "Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + "type": "boolean", + "readOnly": true + } + } + }, + "UnencryptedCredentials": { + "description": "Unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "jobName": { + "description": "Name of the job.", + "type": "string", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "description": "List of unencrypted credentials for accessing device.", + "type": "object", + "properties": { + "value": { + "description": "List of unencrypted credentials.", + "type": "array", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "description": "Link for the next set of unencrypted credentials.", + "type": "string" + } + } + }, + "UpdateJobDetails": { + "description": "Job details for update.", + "type": "object", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails" + }, + "preferences": { + "$ref": "#/definitions/Preferences" + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package details of job." + } + } + }, + "UpdateJobProperties": { + "description": "Job Properties for update", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedIdentity": { + "description": "Class defining User assigned identity details.", + "type": "object", + "properties": { + "principalId": { + "description": "The principal id of user assigned identity.", + "type": "string", + "readOnly": true + }, + "clientId": { + "description": "The client id of user assigned identity.", + "type": "string", + "readOnly": true + } + } + }, + "UserAssignedProperties": { + "description": "User assigned identity properties.", + "type": "object", + "properties": { + "resourceId": { + "description": "Arm resource id for user assigned identity to be used to fetch MSI token.", + "type": "string" + } + } + }, + "ValidateAddress": { + "description": "The requirements to validate customer address where the device needs to be shipped.", + "required": [ + "shippingAddress", + "deviceType", + "validationType" + ], + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "description": "Device type to be used for the job.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "type": "string", + "x-ms-enum": { + "name": "SkuName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk." + } + ] + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "model": { + "$ref": "#/definitions/ModelName" + } + }, + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputRequest": { + "description": "Minimum fields that must be present in any type of validation request.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + } + }, + "discriminator": "validationType" + }, + "ValidationInputResponse": { + "description": "Minimum properties that should be present in each individual validation response.", + "required": [ + "validationType" + ], + "type": "object", + "properties": { + "validationType": { + "description": "Identifies the type of validation response.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsExtensible": true, + "values": [ + { + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType" + }, + "ValidationRequest": { + "description": "Minimum request requirement of any validation category.", + "required": [ + "validationCategory", + "individualRequestDetails" + ], + "type": "object", + "properties": { + "validationCategory": { + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "type": "string", + "x-ms-enum": { + "name": "ValidationCategory", + "modelAsExtensible": true, + "values": [ + { + "value": "JobCreationValidation", + "description": "Identify request of pre-job creation validations." + } + ] + } + }, + "individualRequestDetails": { + "description": "List of request details contain validationType and its request as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory" + }, + "ValidationResponse": { + "description": "Response of pre job creation validations.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "description": "Properties of pre job creation validation response.", + "type": "object", + "properties": { + "status": { + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsExtensible": true, + "values": [ + { + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "individualResponseDetails": { + "description": "List of response details contain validationType and its response as key and value respectively.", + "type": "array", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + }, + "ModelName": { + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk", + "AzureDataBox120", + "AzureDataBox525" + ], + "type": "string", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + "x-ms-enum": { + "name": "ModelName", + "modelAsExtensible": true, + "values": [ + { + "value": "DataBox", + "description": "Data Box." + }, + { + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + }, + { + "value": "AzureDataBox120", + "description": "Data Box V2 with 125TB usable capacity." + }, + { + "value": "AzureDataBox525", + "description": "Data Box V2 with 500TB usable capacity." + } + ] + } + } + }, + "parameters": { + "apiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "The API Version", + "required": true, + "type": "string" + }, + "jobNameParameter": { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "maxLength": 24, + "minLength": 3, + "pattern": "^[-\\w\\.]+$", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "The location of the resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "resourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "description": "The Resource Group Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "subscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "description": "The Subscription Id", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2025-07-01/databox.json b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2025-07-01/databox.json new file mode 100644 index 00000000000..098e7ff83da --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/stable/2025-07-01/databox.json @@ -0,0 +1,6063 @@ +{ + "swagger": "2.0", + "info": { + "title": "DataBoxManagementClient", + "version": "2025-07-01", + "x-typespec-generated": [ + { + "emitter": "@azure-tools/typespec-autorest" + } + ] + }, + "schemes": [ + "https" + ], + "host": "management.azure.com", + "produces": [ + "application/json" + ], + "consumes": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow.", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "tags": [ + { + "name": "JobResources" + }, + { + "name": "Operations" + } + ], + "paths": { + "/providers/Microsoft.DataBox/operations": { + "get": { + "operationId": "Operations_List", + "tags": [ + "Operations" + ], + "description": "List the operations for the provider", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs": { + "get": { + "operationId": "Jobs_List", + "tags": [ + "JobResources" + ], + "description": "Lists all the jobs available under the subscription.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "operationId": "Service_RegionConfiguration", + "description": "This API provides configuration details specific to given region/location at Subscription level.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/LocationParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "The request body", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress": { + "post": { + "operationId": "Service_ValidateAddress", + "description": "[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/LocationParameter" + }, + { + "name": "validateAddress", + "in": "body", + "description": "The request body", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateAddress" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/AddressValidationOutput" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "deprecated": true + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "operationId": "Service_ValidateInputs", + "description": "This method does all necessary pre-job creation validation under subscription.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/LocationParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "The request body", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs": { + "get": { + "operationId": "Jobs_ListByResourceGroup", + "tags": [ + "JobResources" + ], + "description": "Lists all the jobs available under the given resource group.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "$skipToken", + "in": "query", + "description": "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/JobResourceList" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}": { + "get": { + "operationId": "Jobs_Get", + "tags": [ + "JobResources" + ], + "description": "Gets information about the specified job.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "minLength": 3, + "maxLength": 24, + "pattern": "^[-\\w\\.]+$" + }, + { + "name": "$expand", + "in": "query", + "description": "$expand is supported on details parameter for job, which provides details on the job stages.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + } + }, + "put": { + "operationId": "Jobs_Create", + "tags": [ + "JobResources" + ], + "description": "Creates a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the Update job API.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "minLength": 3, + "maxLength": 24, + "pattern": "^[-\\w\\.]+$" + }, + { + "name": "jobResource", + "in": "body", + "description": "Job details from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResource" + } + } + ], + "responses": { + "200": { + "description": "Resource 'JobResource' update operation succeeded", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Resource operation accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location", + "final-state-schema": "#/definitions/JobResource" + }, + "x-ms-long-running-operation": true + }, + "patch": { + "operationId": "Jobs_Update", + "tags": [ + "JobResources" + ], + "description": "Updates the properties of an existing job.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "minLength": 3, + "maxLength": 24, + "pattern": "^[-\\w\\.]+$" + }, + { + "name": "If-Match", + "in": "header", + "description": "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + "required": false, + "type": "string" + }, + { + "name": "jobResourceUpdateParameter", + "in": "body", + "description": "Job update parameters from request body.", + "required": true, + "schema": { + "$ref": "#/definitions/JobResourceUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/JobResource" + } + }, + "202": { + "description": "Resource update request accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location", + "final-state-schema": "#/definitions/JobResource" + }, + "x-ms-long-running-operation": true + }, + "delete": { + "operationId": "Jobs_Delete", + "tags": [ + "JobResources" + ], + "description": "Deletes a job.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "minLength": 3, + "maxLength": 24, + "pattern": "^[-\\w\\.]+$" + } + ], + "responses": { + "200": { + "description": "Resource deleted successfully." + }, + "202": { + "description": "Resource deletion accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp": { + "post": { + "operationId": "Jobs_BookShipmentPickUp", + "tags": [ + "JobResources" + ], + "description": "Book shipment pick up.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "minLength": 3, + "maxLength": 24, + "pattern": "^[-\\w\\.]+$" + }, + { + "name": "shipmentPickUpRequest", + "in": "body", + "description": "Details of shipment pick up request.", + "required": true, + "schema": { + "$ref": "#/definitions/ShipmentPickUpRequest" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/ShipmentPickUpResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel": { + "post": { + "operationId": "Jobs_Cancel", + "tags": [ + "JobResources" + ], + "description": "CancelJob.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "minLength": 3, + "maxLength": 24, + "pattern": "^[-\\w\\.]+$" + }, + { + "name": "cancellationReason", + "in": "body", + "description": "Reason for cancellation.", + "required": true, + "schema": { + "$ref": "#/definitions/CancellationReason" + } + } + ], + "responses": { + "204": { + "description": "There is no content to send for this request, but the headers may be useful." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials": { + "post": { + "operationId": "Jobs_ListCredentials", + "tags": [ + "JobResources" + ], + "description": "This method gets the unencrypted secrets related to the job.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "minLength": 3, + "maxLength": 24, + "pattern": "^[-\\w\\.]+$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/UnencryptedCredentialsList" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped": { + "post": { + "operationId": "Jobs_MarkDevicesShipped", + "tags": [ + "JobResources" + ], + "description": "Request to mark devices for a given job as shipped", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "minLength": 3, + "maxLength": 24, + "pattern": "^[-\\w\\.]+$" + }, + { + "name": "markDevicesShippedRequest", + "in": "body", + "description": "Mark Devices Shipped Request", + "required": true, + "schema": { + "$ref": "#/definitions/MarkDevicesShippedRequest" + } + } + ], + "responses": { + "204": { + "description": "There is no content to send for this request, but the headers may be useful." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate": { + "post": { + "operationId": "Mitigate", + "tags": [ + "JobResources" + ], + "description": "Request to mitigate for a given job", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "jobName", + "in": "path", + "description": "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + "required": true, + "type": "string", + "minLength": 3, + "maxLength": 24, + "pattern": "^[-\\w\\.]+$" + }, + { + "name": "mitigateJobRequest", + "in": "body", + "description": "Mitigation Request", + "required": true, + "schema": { + "$ref": "#/definitions/MitigateJobRequest" + } + } + ], + "responses": { + "204": { + "description": "There is no content to send for this request, but the headers may be useful." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus": { + "post": { + "operationId": "Service_ListAvailableSkusByResourceGroup", + "description": "This method provides the list of available skus for the given subscription, resource group and location.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/LocationParameter" + }, + { + "name": "availableSkuRequest", + "in": "body", + "description": "Filters for showing the available skus.", + "required": true, + "schema": { + "$ref": "#/definitions/AvailableSkuRequest" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/AvailableSkusResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration": { + "post": { + "operationId": "Service_RegionConfigurationByResourceGroup", + "description": "This API provides configuration details specific to given region/location at Resource group level.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/LocationParameter" + }, + { + "name": "regionConfigurationRequest", + "in": "body", + "description": "Request body to get the configuration for the region at resource group level.", + "required": true, + "schema": { + "$ref": "#/definitions/RegionConfigurationRequest" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/RegionConfigurationResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs": { + "post": { + "operationId": "Service_ValidateInputsByResourceGroup", + "description": "This method does all necessary pre-job creation validation under resource group.", + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/LocationParameter" + }, + { + "name": "validationRequest", + "in": "body", + "description": "Inputs of the customer.", + "required": true, + "schema": { + "$ref": "#/definitions/ValidationRequest" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/ValidationResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + } + } + } + }, + "definitions": { + "AccessProtocol": { + "type": "string", + "description": "Access protocols supported on the device.", + "enum": [ + "SMB", + "NFS" + ], + "x-ms-enum": { + "name": "AccessProtocol", + "modelAsString": false, + "values": [ + { + "name": "SMB", + "value": "SMB", + "description": "Server Message Block protocol(SMB)." + }, + { + "name": "NFS", + "value": "NFS", + "description": "Network File System protocol(NFS)." + } + ] + } + }, + "AccountCredentialDetails": { + "type": "object", + "description": "Credential details of the account.", + "properties": { + "accountName": { + "type": "string", + "description": "Name of the account.", + "readOnly": true + }, + "dataAccountType": { + "$ref": "#/definitions/DataAccountType", + "description": "Type of the account.", + "readOnly": true + }, + "accountConnectionString": { + "type": "string", + "description": "Connection string of the account endpoint to use the account as a storage endpoint on the device.", + "readOnly": true + }, + "shareCredentialDetails": { + "type": "array", + "description": "Per share level unencrypted access credentials.", + "items": { + "$ref": "#/definitions/ShareCredentialDetails" + }, + "readOnly": true + } + } + }, + "AdditionalErrorInfo": { + "type": "object", + "description": "This class represents additional info which Resource Providers pass when an error occurs.", + "properties": { + "info": { + "type": "object", + "description": "Additional information of the type of error.", + "additionalProperties": {} + }, + "type": { + "type": "string", + "description": "Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation)." + } + } + }, + "AddressType": { + "type": "string", + "description": "Type of address.", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "x-ms-enum": { + "name": "AddressType", + "modelAsString": false, + "values": [ + { + "name": "None", + "value": "None", + "description": "Address type not known." + }, + { + "name": "Residential", + "value": "Residential", + "description": "Residential Address." + }, + { + "name": "Commercial", + "value": "Commercial", + "description": "Commercial Address." + } + ] + } + }, + "AddressValidationOutput": { + "type": "object", + "description": "Output of the address validation api.", + "properties": { + "properties": { + "$ref": "#/definitions/AddressValidationProperties", + "description": "The address validation properties.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "AddressValidationProperties": { + "type": "object", + "description": "The address validation output.", + "properties": { + "validationStatus": { + "$ref": "#/definitions/AddressValidationStatus", + "description": "The address validation status.", + "readOnly": true + }, + "alternateAddresses": { + "type": "array", + "description": "List of alternate addresses.", + "items": { + "$ref": "#/definitions/ShippingAddress" + }, + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "x-ms-discriminator-value": "ValidateAddress" + }, + "AddressValidationStatus": { + "type": "string", + "description": "The address validation status.", + "enum": [ + "Valid", + "Invalid", + "Ambiguous" + ], + "x-ms-enum": { + "name": "AddressValidationStatus", + "modelAsString": false, + "values": [ + { + "name": "Valid", + "value": "Valid", + "description": "Address provided is valid." + }, + { + "name": "Invalid", + "value": "Invalid", + "description": "Address provided is invalid or not supported." + }, + { + "name": "Ambiguous", + "value": "Ambiguous", + "description": "Address provided is ambiguous, please choose one of the alternate addresses returned." + } + ] + } + }, + "ApiError": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetail", + "description": "The error detail." + } + }, + "required": [ + "error" + ] + }, + "ApplianceNetworkConfiguration": { + "type": "object", + "description": "The Network Adapter configuration of a DataBox.", + "properties": { + "name": { + "type": "string", + "description": "Name of the network.", + "readOnly": true + }, + "macAddress": { + "type": "string", + "description": "Mac Address.", + "readOnly": true + } + } + }, + "ArmBaseObject": { + "type": "object", + "description": "Base class for all objects under resource.", + "properties": { + "name": { + "type": "string", + "description": "Name of the object.", + "readOnly": true + }, + "id": { + "type": "string", + "description": "Id of the object.", + "readOnly": true + }, + "type": { + "type": "string", + "description": "Type of the object.", + "readOnly": true + } + } + }, + "AvailableSkuRequest": { + "type": "object", + "description": "The filters for showing the available skus.", + "properties": { + "transferType": { + "$ref": "#/definitions/TransferType", + "description": "Type of the transfer." + }, + "country": { + "type": "string", + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements" + }, + "location": { + "type": "string", + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01" + }, + "skuNames": { + "type": "array", + "description": "Sku Names to filter for available skus", + "items": { + "$ref": "#/definitions/SkuName" + } + } + }, + "required": [ + "transferType", + "country", + "location" + ] + }, + "AvailableSkusResult": { + "type": "object", + "description": "The available skus operation response.", + "properties": { + "value": { + "type": "array", + "description": "[Placeholder] Description for page model", + "items": { + "$ref": "#/definitions/SkuInformation" + }, + "readOnly": true + }, + "nextLink": { + "type": "string", + "description": "[Placeholder] Description for nextLink property" + } + }, + "required": [ + "value" + ] + }, + "AzureFileFilterDetails": { + "type": "object", + "description": "Filter details to transfer Azure files", + "properties": { + "filePrefixList": { + "type": "array", + "description": "Prefix list of the Azure files to be transferred.", + "items": { + "type": "string" + } + }, + "filePathList": { + "type": "array", + "description": "List of full path of the files to be transferred.", + "items": { + "type": "string" + } + }, + "fileShareList": { + "type": "array", + "description": "List of file shares to be transferred.", + "items": { + "type": "string" + } + } + } + }, + "BlobFilterDetails": { + "type": "object", + "description": "Filter details to transfer Azure Blobs", + "properties": { + "blobPrefixList": { + "type": "array", + "description": "Prefix list of the Azure blobs to be transferred.", + "items": { + "type": "string" + } + }, + "blobPathList": { + "type": "array", + "description": "List of full path of the blobs to be transferred.", + "items": { + "type": "string" + } + }, + "containerList": { + "type": "array", + "description": "List of blob containers to be transferred.", + "items": { + "type": "string" + } + } + } + }, + "CancellationReason": { + "type": "object", + "description": "Reason for cancellation.", + "properties": { + "reason": { + "type": "string", + "description": "Reason for cancellation." + } + }, + "required": [ + "reason" + ] + }, + "ClassDiscriminator": { + "type": "string", + "description": "Indicates the type of job details.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "x-ms-enum": { + "name": "ClassDiscriminator", + "modelAsString": false, + "values": [ + { + "name": "DataBox", + "value": "DataBox", + "description": "Data Box orders." + }, + { + "name": "DataBoxDisk", + "value": "DataBoxDisk", + "description": "Data Box Disk orders." + }, + { + "name": "DataBoxHeavy", + "value": "DataBoxHeavy", + "description": "Data Box Heavy orders." + }, + { + "name": "DataBoxCustomerDisk", + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk orders." + } + ] + } + }, + "CloudError": { + "type": "object", + "description": "Provides additional information about an http error response.", + "properties": { + "additionalInfo": { + "type": "array", + "description": "Gets or sets additional error info.", + "items": { + "$ref": "#/definitions/AdditionalErrorInfo" + }, + "readOnly": true + }, + "code": { + "type": "string", + "description": "Error code." + }, + "details": { + "type": "array", + "description": "Gets or sets details for the error.", + "items": { + "$ref": "#/definitions/CloudError" + }, + "readOnly": true + }, + "message": { + "type": "string", + "description": "The error message parsed from the body of the http error response." + }, + "target": { + "type": "string", + "description": "Gets or sets the target of the error." + } + } + }, + "ContactDetails": { + "type": "object", + "description": "Contact Details.", + "properties": { + "contactName": { + "type": "string", + "description": "Contact name of the person." + }, + "phone": { + "type": "string", + "description": "Phone number of the contact person." + }, + "phoneExtension": { + "type": "string", + "description": "Phone extension number of the contact person." + }, + "mobile": { + "type": "string", + "description": "Mobile number of the contact person." + }, + "emailList": { + "type": "array", + "description": "List of Email-ids to be notified about job progress.", + "items": { + "type": "string" + } + }, + "notificationPreference": { + "type": "array", + "description": "Notification preference for a job stage.", + "items": { + "$ref": "#/definitions/NotificationPreference" + } + } + }, + "required": [ + "contactName", + "phone", + "emailList" + ] + }, + "ContactInfo": { + "type": "object", + "description": "Contact Info.", + "properties": { + "contactName": { + "type": "string", + "description": "Contact name of the person.", + "minLength": 1 + }, + "phone": { + "type": "string", + "description": "Phone number of the contact person.", + "minLength": 1 + }, + "phoneExtension": { + "type": "string", + "description": "Phone extension number of the contact person." + }, + "mobile": { + "type": "string", + "description": "Mobile number of the contact person." + } + }, + "required": [ + "contactName", + "phone" + ] + }, + "CopyLogDetails": { + "type": "object", + "description": "Details for log generated during copy.", + "properties": { + "copyLogDetailsType": { + "$ref": "#/definitions/ClassDiscriminator", + "description": "Indicates the type of job details." + } + }, + "discriminator": "copyLogDetailsType", + "required": [ + "copyLogDetailsType" + ] + }, + "CopyProgress": { + "type": "object", + "description": "Copy progress.", + "properties": { + "storageAccountName": { + "type": "string", + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "readOnly": true + }, + "transferType": { + "$ref": "#/definitions/TransferType", + "description": "Transfer type of data", + "readOnly": true + }, + "dataAccountType": { + "$ref": "#/definitions/DataAccountType", + "description": "Data Account Type.", + "readOnly": true + }, + "accountId": { + "type": "string", + "description": "Id of the account where the data needs to be uploaded.", + "readOnly": true + }, + "bytesProcessed": { + "type": "integer", + "format": "int64", + "description": "To indicate bytes transferred.", + "readOnly": true + }, + "totalBytesToProcess": { + "type": "integer", + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "readOnly": true + }, + "filesProcessed": { + "type": "integer", + "format": "int64", + "description": "Number of files processed", + "readOnly": true + }, + "totalFilesToProcess": { + "type": "integer", + "format": "int64", + "description": "Total files to process", + "readOnly": true + }, + "invalidFilesProcessed": { + "type": "integer", + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "type": "integer", + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "readOnly": true + }, + "renamedContainerCount": { + "type": "integer", + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "readOnly": true + }, + "filesErroredOut": { + "type": "integer", + "format": "int64", + "description": "Number of files which could not be copied", + "readOnly": true + }, + "directoriesErroredOut": { + "type": "integer", + "format": "int64", + "description": "To indicate directories errored out in the job.", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "type": "integer", + "format": "int64", + "description": "To indicate directories renamed", + "readOnly": true + }, + "isEnumerationInProgress": { + "type": "boolean", + "description": "To indicate if enumeration of data is in progress.\nUntil this is true, the TotalBytesToProcess may not be valid.", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "type": "array", + "description": "Available actions on the job.", + "items": { + "$ref": "#/definitions/CustomerResolutionCode" + }, + "readOnly": true + } + } + }, + "CopyStatus": { + "type": "string", + "description": "The Status of the copy", + "enum": [ + "NotStarted", + "InProgress", + "Completed", + "CompletedWithErrors", + "Failed", + "NotReturned", + "HardwareError", + "DeviceFormatted", + "DeviceMetadataModified", + "StorageAccountNotAccessible", + "UnsupportedData", + "DriveNotReceived", + "UnsupportedDrive", + "OtherServiceError", + "OtherUserError", + "DriveNotDetected", + "DriveCorrupted", + "MetadataFilesModifiedOrRemoved" + ], + "x-ms-enum": { + "name": "CopyStatus", + "modelAsString": true, + "values": [ + { + "name": "NotStarted", + "value": "NotStarted", + "description": "Data copy hasn't started yet." + }, + { + "name": "InProgress", + "value": "InProgress", + "description": "Data copy is in progress." + }, + { + "name": "Completed", + "value": "Completed", + "description": "Data copy completed." + }, + { + "name": "CompletedWithErrors", + "value": "CompletedWithErrors", + "description": "Data copy completed with errors." + }, + { + "name": "Failed", + "value": "Failed", + "description": "Data copy failed. No data was copied." + }, + { + "name": "NotReturned", + "value": "NotReturned", + "description": "No copy triggered as device was not returned." + }, + { + "name": "HardwareError", + "value": "HardwareError", + "description": "The Device has hit hardware issues." + }, + { + "name": "DeviceFormatted", + "value": "DeviceFormatted", + "description": "Data copy failed. The Device was formatted by user." + }, + { + "name": "DeviceMetadataModified", + "value": "DeviceMetadataModified", + "description": "Data copy failed. Device metadata was modified by user." + }, + { + "name": "StorageAccountNotAccessible", + "value": "StorageAccountNotAccessible", + "description": "Data copy failed. Storage Account was not accessible during copy." + }, + { + "name": "UnsupportedData", + "value": "UnsupportedData", + "description": "Data copy failed. The Device data content is not supported." + }, + { + "name": "DriveNotReceived", + "value": "DriveNotReceived", + "description": "No copy triggered as device was not received." + }, + { + "name": "UnsupportedDrive", + "value": "UnsupportedDrive", + "description": "No copy triggered as device type is not supported." + }, + { + "name": "OtherServiceError", + "value": "OtherServiceError", + "description": "Copy failed due to service error." + }, + { + "name": "OtherUserError", + "value": "OtherUserError", + "description": "Copy failed due to user error." + }, + { + "name": "DriveNotDetected", + "value": "DriveNotDetected", + "description": "Copy failed due to disk detection error." + }, + { + "name": "DriveCorrupted", + "value": "DriveCorrupted", + "description": "Copy failed due to corrupted drive." + }, + { + "name": "MetadataFilesModifiedOrRemoved", + "value": "MetadataFilesModifiedOrRemoved", + "description": "Copy failed due to modified or removed metadata files." + } + ] + } + }, + "CreateJobValidations": { + "type": "object", + "description": "It does all pre-job creation validations.", + "allOf": [ + { + "$ref": "#/definitions/ValidationRequest" + } + ], + "x-ms-discriminator-value": "JobCreationValidation" + }, + "CreateOrderLimitForSubscriptionValidationRequest": { + "type": "object", + "description": "Request to validate create order limit for current subscription.", + "properties": { + "deviceType": { + "$ref": "#/definitions/SkuName", + "description": "Device type to be used for the job." + }, + "model": { + "$ref": "#/definitions/ModelName", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025" + } + }, + "required": [ + "deviceType" + ], + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CreateOrderLimitForSubscriptionValidationResponseProperties": { + "type": "object", + "description": "Properties of create order limit for subscription validation response.", + "properties": { + "status": { + "$ref": "#/definitions/ValidationStatus", + "description": "Create order limit validation status.", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "x-ms-discriminator-value": "ValidateCreateOrderLimit" + }, + "CustomerDiskJobSecrets": { + "type": "object", + "description": "The secrets related to customer disk job.", + "properties": { + "diskSecrets": { + "type": "array", + "description": "Contains the list of secrets object for that device.", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "carrierAccountNumber": { + "type": "string", + "format": "password", + "description": "Carrier Account Number of the customer", + "readOnly": true, + "x-ms-secret": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "CustomerResolutionCode": { + "type": "string", + "description": "Resolution code provided by customer.", + "enum": [ + "None", + "MoveToCleanUpDevice", + "Resume", + "Restart", + "ReachOutToOperation" + ], + "x-ms-enum": { + "name": "CustomerResolutionCode", + "modelAsString": false, + "values": [ + { + "name": "None", + "value": "None", + "description": "No Resolution Yet" + }, + { + "name": "MoveToCleanUpDevice", + "value": "MoveToCleanUpDevice", + "description": "Clean the device" + }, + { + "name": "Resume", + "value": "Resume", + "description": "Resume the job to same stage" + }, + { + "name": "Restart", + "value": "Restart", + "description": "Restart whole action." + }, + { + "name": "ReachOutToOperation", + "value": "ReachOutToOperation", + "description": "Reach out to operation for further action." + } + ] + } + }, + "DataAccountDetails": { + "type": "object", + "description": "Account details of the data to be transferred", + "properties": { + "dataAccountType": { + "type": "string", + "description": "Account Type of the data to be transferred.", + "default": "StorageAccount", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "x-ms-enum": { + "name": "DataAccountType", + "modelAsString": false, + "values": [ + { + "name": "StorageAccount", + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "name": "ManagedDisk", + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "sharePassword": { + "type": "string", + "format": "password", + "description": "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+", + "x-ms-mutability": [ + "create" + ], + "x-ms-secret": true + } + }, + "discriminator": "dataAccountType", + "required": [ + "dataAccountType" + ] + }, + "DataAccountType": { + "type": "string", + "description": "Type of the account.", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "x-ms-enum": { + "name": "DataAccountType", + "modelAsString": false, + "values": [ + { + "name": "StorageAccount", + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "name": "ManagedDisk", + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "DataBoxAccountCopyLogDetails": { + "type": "object", + "description": "Copy log details for a storage account of a DataBox job", + "properties": { + "accountName": { + "type": "string", + "description": "Account name.", + "readOnly": true + }, + "copyLogLink": { + "type": "string", + "description": "Link for copy logs.", + "readOnly": true + }, + "copyVerboseLogLink": { + "type": "string", + "description": "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxCustomerDiskCopyLogDetails": { + "type": "object", + "description": "Copy Log Details for customer disk", + "properties": { + "serialNumber": { + "type": "string", + "description": "Disk Serial Number.", + "readOnly": true + }, + "errorLogLink": { + "type": "string", + "description": "Link for copy error logs.", + "readOnly": true + }, + "verboseLogLink": { + "type": "string", + "description": "Link for copy verbose logs.", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxCustomerDiskCopyProgress": { + "type": "object", + "description": "DataBox CustomerDisk Copy Progress", + "properties": { + "serialNumber": { + "type": "string", + "description": "Disk Serial Number.", + "readOnly": true + }, + "copyStatus": { + "$ref": "#/definitions/CopyStatus", + "description": "The Status of the copy", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/CopyProgress" + } + ] + }, + "DataBoxCustomerDiskJobDetails": { + "type": "object", + "description": "Customer disk job details.", + "properties": { + "importDiskDetailsCollection": { + "type": "object", + "description": "Contains the map of disk serial number to the disk details for import jobs.", + "additionalProperties": { + "$ref": "#/definitions/ImportDiskDetails" + } + }, + "exportDiskDetailsCollection": { + "type": "object", + "description": "Contains the map of disk serial number to the disk details for export jobs.", + "additionalProperties": { + "$ref": "#/definitions/ExportDiskDetails" + }, + "readOnly": true + }, + "copyProgress": { + "type": "array", + "description": "Copy progress per disk.", + "items": { + "$ref": "#/definitions/DataBoxCustomerDiskCopyProgress" + }, + "readOnly": true + }, + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package shipping details." + }, + "enableManifestBackup": { + "type": "boolean", + "description": "Flag to indicate if disk manifest should be backed-up in the Storage Account.", + "default": false + } + }, + "required": [ + "returnToCustomerPackageDetails" + ], + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskCopyLogDetails": { + "type": "object", + "description": "Copy Log Details for a disk", + "properties": { + "diskSerialNumber": { + "type": "string", + "description": "Disk Serial Number.", + "readOnly": true + }, + "errorLogLink": { + "type": "string", + "description": "Link for copy error logs.", + "readOnly": true + }, + "verboseLogLink": { + "type": "string", + "description": "Link for copy verbose logs.", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskCopyProgress": { + "type": "object", + "description": "DataBox Disk Copy Progress", + "properties": { + "serialNumber": { + "type": "string", + "description": "The serial number of the disk", + "readOnly": true + }, + "bytesCopied": { + "type": "integer", + "format": "int64", + "description": "Bytes copied during the copy of disk.", + "readOnly": true + }, + "percentComplete": { + "type": "integer", + "format": "int32", + "description": "Indicates the percentage completed for the copy of the disk.", + "readOnly": true + }, + "status": { + "$ref": "#/definitions/CopyStatus", + "description": "The Status of the copy", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "type": "array", + "description": "Available actions on the job.", + "items": { + "$ref": "#/definitions/CustomerResolutionCode" + }, + "readOnly": true + } + } + }, + "DataBoxDiskGranularCopyLogDetails": { + "type": "object", + "description": "Granular Copy Log Details for customer disk", + "properties": { + "serialNumber": { + "type": "string", + "description": "Disk Serial Number.", + "readOnly": true + }, + "accountId": { + "type": "string", + "description": "Account id.", + "readOnly": true + }, + "errorLogLink": { + "type": "string", + "description": "Link for copy error logs.", + "readOnly": true + }, + "verboseLogLink": { + "type": "string", + "description": "Link for copy verbose logs.", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/GranularCopyLogDetails" + } + ], + "x-ms-discriminator-value": "DataBoxCustomerDisk" + }, + "DataBoxDiskGranularCopyProgress": { + "type": "object", + "description": "DataBox Disk Granular Copy Progress", + "properties": { + "serialNumber": { + "type": "string", + "description": "Disk Serial Number.", + "readOnly": true + }, + "copyStatus": { + "$ref": "#/definitions/CopyStatus", + "description": "The Status of the copy", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/GranularCopyProgress" + } + ] + }, + "DataBoxDiskJobDetails": { + "type": "object", + "description": "DataBox Disk Job Details.", + "properties": { + "preferredDisks": { + "type": "object", + "description": "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "copyProgress": { + "type": "array", + "description": "Copy progress per disk.", + "items": { + "$ref": "#/definitions/DataBoxDiskCopyProgress" + }, + "readOnly": true + }, + "granularCopyProgress": { + "type": "array", + "description": "Copy progress per disk.", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyProgress" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "granularCopyLogDetails": { + "type": "array", + "description": "Copy progress per disk.", + "items": { + "$ref": "#/definitions/DataBoxDiskGranularCopyLogDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "disksAndSizeDetails": { + "type": "object", + "description": "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + "additionalProperties": { + "format": "int32", + "type": "integer" + }, + "readOnly": true + }, + "passkey": { + "type": "string", + "description": "User entered passkey for DataBox Disk job." + } + }, + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxDiskJobSecrets": { + "type": "object", + "description": "The secrets related to disk job.", + "properties": { + "diskSecrets": { + "type": "array", + "description": "Contains the list of secrets object for that device.", + "items": { + "$ref": "#/definitions/DiskSecret" + }, + "readOnly": true + }, + "passKey": { + "type": "string", + "description": "PassKey for the disk Job.", + "readOnly": true + }, + "isPasskeyUserDefined": { + "type": "boolean", + "description": "Whether passkey was provided by user.", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DataBoxHeavyAccountCopyLogDetails": { + "type": "object", + "description": "Copy log details for a storage account for Databox heavy", + "properties": { + "accountName": { + "type": "string", + "description": "Account name.", + "readOnly": true + }, + "copyLogLink": { + "type": "array", + "description": "Link for copy logs.", + "items": { + "type": "string" + }, + "readOnly": true + }, + "copyVerboseLogLink": { + "type": "array", + "description": "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + "items": { + "type": "string" + }, + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/CopyLogDetails" + } + ], + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobDetails": { + "type": "object", + "description": "Databox Heavy Device Job Details", + "properties": { + "copyProgress": { + "type": "array", + "description": "Copy progress per account.", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "type": "string", + "description": "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+" + } + }, + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavyJobSecrets": { + "type": "object", + "description": "The secrets related to a databox heavy job.", + "properties": { + "cabinetPodSecrets": { + "type": "array", + "description": "Contains the list of secret objects for a databox heavy job.", + "items": { + "$ref": "#/definitions/DataBoxHeavySecret" + }, + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "DataBoxHeavySecret": { + "type": "object", + "description": "The secrets related to a databox heavy.", + "properties": { + "deviceSerialNumber": { + "type": "string", + "description": "Serial number of the assigned device.", + "readOnly": true + }, + "devicePassword": { + "type": "string", + "description": "Password for out of the box experience on device.", + "readOnly": true + }, + "networkConfigurations": { + "type": "array", + "description": "Network configuration of the appliance.", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "type": "string", + "description": "The base 64 encoded public key to authenticate with the device", + "readOnly": true + }, + "accountCredentialDetails": { + "type": "array", + "description": "Per account level access credentials.", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataBoxJobDetails": { + "type": "object", + "description": "Databox Job Details", + "properties": { + "copyProgress": { + "type": "array", + "description": "Copy progress per storage account.", + "items": { + "$ref": "#/definitions/CopyProgress" + }, + "readOnly": true + }, + "devicePassword": { + "type": "string", + "description": "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+" + } + }, + "allOf": [ + { + "$ref": "#/definitions/JobDetails" + } + ], + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxScheduleAvailabilityRequest": { + "type": "object", + "description": "Request body to get the availability for scheduling data box orders orders.", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "x-ms-discriminator-value": "DataBox" + }, + "DataBoxSecret": { + "type": "object", + "description": "The secrets related to a DataBox.", + "properties": { + "deviceSerialNumber": { + "type": "string", + "description": "Serial number of the assigned device.", + "readOnly": true + }, + "devicePassword": { + "type": "string", + "description": "Password for out of the box experience on device.", + "readOnly": true + }, + "networkConfigurations": { + "type": "array", + "description": "Network configuration of the appliance.", + "items": { + "$ref": "#/definitions/ApplianceNetworkConfiguration" + }, + "readOnly": true + }, + "encodedValidationCertPubKey": { + "type": "string", + "description": "The base 64 encoded public key to authenticate with the device", + "readOnly": true + }, + "accountCredentialDetails": { + "type": "array", + "description": "Per account level access credentials.", + "items": { + "$ref": "#/definitions/AccountCredentialDetails" + }, + "readOnly": true + } + } + }, + "DataCenterCode": { + "type": "string", + "description": "DataCenter code.", + "enum": [ + "Invalid", + "BY2", + "BY1", + "ORK70", + "AM2", + "AMS20", + "BY21", + "BY24", + "MWH01", + "AMS06", + "SSE90", + "SYD03", + "SYD23", + "CBR20", + "YTO20", + "CWL20", + "LON24", + "BOM01", + "BL20", + "BL7", + "SEL20", + "TYO01", + "BN1", + "SN5", + "CYS04", + "TYO22", + "YTO21", + "YQB20", + "FRA22", + "MAA01", + "CPQ02", + "CPQ20", + "SIN20", + "HKG20", + "SG2", + "MEL23", + "SEL21", + "OSA20", + "SHA03", + "BJB", + "JNB22", + "JNB21", + "MNZ21", + "SN8", + "AUH20", + "ZRH20", + "PUS20", + "AdHoc", + "CH1", + "DSM05", + "DUB07", + "PNQ01", + "SVG20", + "OSA02", + "OSA22", + "PAR22", + "BN7", + "SN6", + "BJS20", + "BL24", + "IDC5", + "TYO23", + "NTG20", + "DXB23", + "DSM11", + "AMS25", + "CPQ21", + "OSA23" + ], + "x-ms-enum": { + "name": "DataCenterCode", + "modelAsString": true, + "values": [ + { + "name": "Invalid", + "value": "Invalid" + }, + { + "name": "BY2", + "value": "BY2" + }, + { + "name": "BY1", + "value": "BY1" + }, + { + "name": "ORK70", + "value": "ORK70" + }, + { + "name": "AM2", + "value": "AM2" + }, + { + "name": "AMS20", + "value": "AMS20" + }, + { + "name": "BY21", + "value": "BY21" + }, + { + "name": "BY24", + "value": "BY24" + }, + { + "name": "MWH01", + "value": "MWH01" + }, + { + "name": "AMS06", + "value": "AMS06" + }, + { + "name": "SSE90", + "value": "SSE90" + }, + { + "name": "SYD03", + "value": "SYD03" + }, + { + "name": "SYD23", + "value": "SYD23" + }, + { + "name": "CBR20", + "value": "CBR20" + }, + { + "name": "YTO20", + "value": "YTO20" + }, + { + "name": "CWL20", + "value": "CWL20" + }, + { + "name": "LON24", + "value": "LON24" + }, + { + "name": "BOM01", + "value": "BOM01" + }, + { + "name": "BL20", + "value": "BL20" + }, + { + "name": "BL7", + "value": "BL7" + }, + { + "name": "SEL20", + "value": "SEL20" + }, + { + "name": "TYO01", + "value": "TYO01" + }, + { + "name": "BN1", + "value": "BN1" + }, + { + "name": "SN5", + "value": "SN5" + }, + { + "name": "CYS04", + "value": "CYS04" + }, + { + "name": "TYO22", + "value": "TYO22" + }, + { + "name": "YTO21", + "value": "YTO21" + }, + { + "name": "YQB20", + "value": "YQB20" + }, + { + "name": "FRA22", + "value": "FRA22" + }, + { + "name": "MAA01", + "value": "MAA01" + }, + { + "name": "CPQ02", + "value": "CPQ02" + }, + { + "name": "CPQ20", + "value": "CPQ20" + }, + { + "name": "SIN20", + "value": "SIN20" + }, + { + "name": "HKG20", + "value": "HKG20" + }, + { + "name": "SG2", + "value": "SG2" + }, + { + "name": "MEL23", + "value": "MEL23" + }, + { + "name": "SEL21", + "value": "SEL21" + }, + { + "name": "OSA20", + "value": "OSA20" + }, + { + "name": "SHA03", + "value": "SHA03" + }, + { + "name": "BJB", + "value": "BJB" + }, + { + "name": "JNB22", + "value": "JNB22" + }, + { + "name": "JNB21", + "value": "JNB21" + }, + { + "name": "MNZ21", + "value": "MNZ21" + }, + { + "name": "SN8", + "value": "SN8" + }, + { + "name": "AUH20", + "value": "AUH20" + }, + { + "name": "ZRH20", + "value": "ZRH20" + }, + { + "name": "PUS20", + "value": "PUS20" + }, + { + "name": "AdHoc", + "value": "AdHoc" + }, + { + "name": "CH1", + "value": "CH1" + }, + { + "name": "DSM05", + "value": "DSM05" + }, + { + "name": "DUB07", + "value": "DUB07" + }, + { + "name": "PNQ01", + "value": "PNQ01" + }, + { + "name": "SVG20", + "value": "SVG20" + }, + { + "name": "OSA02", + "value": "OSA02" + }, + { + "name": "OSA22", + "value": "OSA22" + }, + { + "name": "PAR22", + "value": "PAR22" + }, + { + "name": "BN7", + "value": "BN7" + }, + { + "name": "SN6", + "value": "SN6" + }, + { + "name": "BJS20", + "value": "BJS20" + }, + { + "name": "BL24", + "value": "BL24" + }, + { + "name": "IDC5", + "value": "IDC5" + }, + { + "name": "TYO23", + "value": "TYO23" + }, + { + "name": "NTG20", + "value": "NTG20" + }, + { + "name": "DXB23", + "value": "DXB23" + }, + { + "name": "DSM11", + "value": "DSM11" + }, + { + "name": "AMS25", + "value": "AMS25" + }, + { + "name": "CPQ21", + "value": "CPQ21" + }, + { + "name": "OSA23", + "value": "OSA23" + } + ] + } + }, + "DataExportDetails": { + "type": "object", + "description": "Details of the data to be used for exporting data from azure.", + "properties": { + "transferConfiguration": { + "$ref": "#/definitions/TransferConfiguration", + "description": "Configuration for the data transfer." + }, + "logCollectionLevel": { + "type": "string", + "description": "Level of the logs to be collected.", + "default": "Error", + "enum": [ + "Error", + "Verbose" + ], + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsString": false, + "values": [ + { + "name": "Error", + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "name": "Verbose", + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + } + }, + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + } + }, + "required": [ + "transferConfiguration", + "accountDetails" + ] + }, + "DataImportDetails": { + "type": "object", + "description": "Details of the data to be used for importing data to azure.", + "properties": { + "accountDetails": { + "$ref": "#/definitions/DataAccountDetails", + "description": "Account details of the data to be transferred" + }, + "logCollectionLevel": { + "type": "string", + "description": "Level of the logs to be collected.", + "default": "Error", + "enum": [ + "Error", + "Verbose" + ], + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsString": false, + "values": [ + { + "name": "Error", + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "name": "Verbose", + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + } + } + }, + "required": [ + "accountDetails" + ] + }, + "DataLocationToServiceLocationMap": { + "type": "object", + "description": "Map of data location to service location", + "properties": { + "dataLocation": { + "type": "string", + "description": "Location of the data.", + "readOnly": true + }, + "serviceLocation": { + "type": "string", + "description": "Location of the service.", + "readOnly": true + } + } + }, + "DataTransferDetailsValidationRequest": { + "type": "object", + "description": "Request to validate export and import data details.", + "properties": { + "dataExportDetails": { + "type": "array", + "description": "List of DataTransfer details to be used to export data from azure.", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "dataImportDetails": { + "type": "array", + "description": "List of DataTransfer details to be used to import data to azure.", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "deviceType": { + "$ref": "#/definitions/SkuName", + "description": "Device type." + }, + "transferType": { + "$ref": "#/definitions/TransferType", + "description": "Type of the transfer." + }, + "model": { + "$ref": "#/definitions/ModelName", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025" + } + }, + "required": [ + "deviceType", + "transferType" + ], + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataTransferDetailsValidationResponseProperties": { + "type": "object", + "description": "Properties of data transfer details validation response.", + "properties": { + "status": { + "$ref": "#/definitions/ValidationStatus", + "description": "Data transfer details validation status.", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "x-ms-discriminator-value": "ValidateDataTransferDetails" + }, + "DataboxJobSecrets": { + "type": "object", + "description": "The secrets related to a databox job.", + "properties": { + "podSecrets": { + "type": "array", + "description": "Contains the list of secret objects for a job.", + "items": { + "$ref": "#/definitions/DataBoxSecret" + } + } + }, + "allOf": [ + { + "$ref": "#/definitions/JobSecrets" + } + ], + "x-ms-discriminator-value": "DataBox" + }, + "DatacenterAddressInstructionResponse": { + "type": "object", + "description": "Datacenter instruction for given storage location.", + "properties": { + "communicationInstruction": { + "type": "string", + "description": "Data center communication instruction", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "x-ms-discriminator-value": "DatacenterAddressInstruction" + }, + "DatacenterAddressLocationResponse": { + "type": "object", + "description": "Datacenter address for given storage location.", + "properties": { + "contactPersonName": { + "type": "string", + "description": "Contact person name", + "readOnly": true + }, + "company": { + "type": "string", + "description": "Company name", + "readOnly": true + }, + "street1": { + "type": "string", + "description": "Street address line 1", + "readOnly": true + }, + "street2": { + "type": "string", + "description": "Street address line 2", + "readOnly": true + }, + "street3": { + "type": "string", + "description": "Street address line 3", + "readOnly": true + }, + "city": { + "type": "string", + "description": "City name", + "readOnly": true + }, + "state": { + "type": "string", + "description": "name of the state", + "readOnly": true + }, + "zip": { + "type": "string", + "description": "Zip code", + "readOnly": true + }, + "country": { + "type": "string", + "description": "name of the country", + "readOnly": true + }, + "phone": { + "type": "string", + "description": "Phone number", + "readOnly": true + }, + "phoneExtension": { + "type": "string", + "description": "Phone extension", + "readOnly": true + }, + "addressType": { + "type": "string", + "description": "Address type", + "readOnly": true + }, + "additionalShippingInformation": { + "type": "string", + "description": "Special instruction for shipping", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/DatacenterAddressResponse" + } + ], + "x-ms-discriminator-value": "DatacenterAddressLocation" + }, + "DatacenterAddressRequest": { + "type": "object", + "description": "Request body to get the datacenter address.", + "properties": { + "storageLocation": { + "type": "string", + "description": "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01" + }, + "skuName": { + "$ref": "#/definitions/SkuName", + "description": "Sku Name for which the data center address requested." + }, + "model": { + "$ref": "#/definitions/ModelName", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025" + } + }, + "required": [ + "storageLocation", + "skuName" + ] + }, + "DatacenterAddressResponse": { + "type": "object", + "description": "Datacenter address for given storage location.", + "properties": { + "datacenterAddressType": { + "$ref": "#/definitions/DatacenterAddressType", + "description": "Data center address type" + }, + "supportedCarriersForReturnShipment": { + "type": "array", + "description": "List of supported carriers for return shipment.", + "items": { + "type": "string" + }, + "readOnly": true + }, + "dataCenterAzureLocation": { + "type": "string", + "description": "Azure Location where the Data Center serves primarily.", + "readOnly": true + } + }, + "discriminator": "datacenterAddressType", + "required": [ + "datacenterAddressType" + ] + }, + "DatacenterAddressType": { + "type": "string", + "description": "Data center address type", + "enum": [ + "DatacenterAddressLocation", + "DatacenterAddressInstruction" + ], + "x-ms-enum": { + "name": "DatacenterAddressType", + "modelAsString": false, + "values": [ + { + "name": "DatacenterAddressLocation", + "value": "DatacenterAddressLocation", + "description": "Data center address location." + }, + { + "name": "DatacenterAddressInstruction", + "value": "DatacenterAddressInstruction", + "description": "Data center address instruction." + } + ] + } + }, + "DcAccessSecurityCode": { + "type": "object", + "description": "Dc access security code", + "properties": { + "reverseDCAccessCode": { + "type": "string", + "description": "Reverse Dc access security code." + }, + "forwardDCAccessCode": { + "type": "string", + "description": "Forward Dc access security code." + } + } + }, + "DelayNotificationStatus": { + "type": "string", + "description": "Status of notification", + "enum": [ + "Active", + "Resolved" + ], + "x-ms-enum": { + "name": "DelayNotificationStatus", + "modelAsString": true, + "values": [ + { + "name": "Active", + "value": "Active", + "description": "Delay is still active" + }, + { + "name": "Resolved", + "value": "Resolved", + "description": "Delay has been resolved" + } + ] + } + }, + "Details": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Error code." + }, + "message": { + "type": "string", + "description": "Error message." + } + }, + "required": [ + "code", + "message" + ] + }, + "DeviceCapabilityDetails": { + "type": "object", + "description": "Device capability details for a given sku for a given region.", + "properties": { + "hardwareEncryption": { + "$ref": "#/definitions/HardwareEncryption", + "description": "Hardware encryption support for a given sku for a given region.", + "readOnly": true + } + } + }, + "DeviceCapabilityRequest": { + "type": "object", + "description": "Request body to get the device capabilities for given sku.", + "properties": { + "skuName": { + "$ref": "#/definitions/SkuName", + "description": "Type of the device." + }, + "model": { + "$ref": "#/definitions/ModelName", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025" + } + } + }, + "DeviceCapabilityResponse": { + "type": "object", + "description": "Device capabilities for given sku in a region", + "properties": { + "deviceCapabilityDetails": { + "type": "array", + "description": "List of device capabilities available for a given region and a given sku", + "items": { + "$ref": "#/definitions/DeviceCapabilityDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + } + } + }, + "DeviceErasureDetails": { + "type": "object", + "description": "Device erasure details with erasure completion status, secure erasure sas key and erasureordestructionlog sas key", + "properties": { + "deviceErasureStatus": { + "$ref": "#/definitions/StageStatus", + "description": "Holds the device erasure completion status", + "readOnly": true + }, + "erasureOrDestructionCertificateSasKey": { + "type": "string", + "description": "Shared access key to download cleanup or destruction certificate for device", + "readOnly": true + }, + "secureErasureCertificateSasKey": { + "type": "string", + "description": "Shared access key to download secure erasure certificate for the device", + "readOnly": true + } + } + }, + "DiskScheduleAvailabilityRequest": { + "type": "object", + "description": "Request body to get the availability for scheduling disk orders.", + "properties": { + "expectedDataSizeInTeraBytes": { + "type": "integer", + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes." + } + }, + "required": [ + "expectedDataSizeInTeraBytes" + ], + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "x-ms-discriminator-value": "DataBoxDisk" + }, + "DiskSecret": { + "type": "object", + "description": "Contains all the secrets of a Disk.", + "properties": { + "diskSerialNumber": { + "type": "string", + "description": "Serial number of the assigned disk.", + "readOnly": true + }, + "bitLockerKey": { + "type": "string", + "description": "Bit Locker key of the disk which can be used to unlock the disk to copy data.", + "readOnly": true + } + } + }, + "DoubleEncryption": { + "type": "string", + "description": "Defines secondary layer of software-based encryption enablement.", + "enum": [ + "Enabled", + "Disabled" + ], + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsString": false, + "values": [ + { + "name": "Enabled", + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "name": "Disabled", + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + } + }, + "EncryptionPreferences": { + "type": "object", + "description": "Preferences related to the Encryption.", + "properties": { + "doubleEncryption": { + "type": "string", + "description": "Defines secondary layer of software-based encryption enablement.", + "default": "Disabled", + "enum": [ + "Enabled", + "Disabled" + ], + "x-ms-enum": { + "name": "DoubleEncryption", + "modelAsString": false, + "values": [ + { + "name": "Enabled", + "value": "Enabled", + "description": "Software-based encryption is enabled." + }, + { + "name": "Disabled", + "value": "Disabled", + "description": "Software-based encryption is disabled." + } + ] + } + }, + "hardwareEncryption": { + "$ref": "#/definitions/HardwareEncryption", + "description": "Defines Hardware level encryption (Only for disk)" + } + } + }, + "ErrorDetail": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Error code." + }, + "message": { + "type": "string", + "description": "Error message." + }, + "details": { + "type": "array", + "description": "Error target.", + "items": { + "$ref": "#/definitions/Details" + } + }, + "target": { + "type": "string", + "description": "Additional error info." + } + }, + "required": [ + "code", + "message" + ] + }, + "ExportDiskDetails": { + "type": "object", + "description": "Export disk details", + "properties": { + "manifestFile": { + "type": "string", + "description": "The relative path of the manifest file on the disk.", + "readOnly": true + }, + "manifestHash": { + "type": "string", + "description": "The Base16-encoded MD5 hash of the manifest file on the disk.", + "readOnly": true + }, + "backupManifestCloudPath": { + "type": "string", + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "readOnly": true + } + } + }, + "FilterFileDetails": { + "type": "object", + "description": "Details of the filter files to be used for data transfer.", + "properties": { + "filterFileType": { + "$ref": "#/definitions/FilterFileType", + "description": "Type of the filter file." + }, + "filterFilePath": { + "type": "string", + "description": "Path of the file that contains the details of all items to transfer." + } + }, + "required": [ + "filterFileType", + "filterFilePath" + ] + }, + "FilterFileType": { + "type": "string", + "description": "Type of the filter file.", + "enum": [ + "AzureBlob", + "AzureFile" + ], + "x-ms-enum": { + "name": "FilterFileType", + "modelAsString": false, + "values": [ + { + "name": "AzureBlob", + "value": "AzureBlob", + "description": "Filter file is of the type AzureBlob." + }, + { + "name": "AzureFile", + "value": "AzureFile", + "description": "Filter file is of the type AzureFiles." + } + ] + } + }, + "GranularCopyLogDetails": { + "type": "object", + "description": "Granular Details for log generated during copy.", + "properties": { + "copyLogDetailsType": { + "$ref": "#/definitions/ClassDiscriminator", + "description": "Indicates the type of job details." + } + }, + "discriminator": "copyLogDetailsType", + "required": [ + "copyLogDetailsType" + ] + }, + "GranularCopyProgress": { + "type": "object", + "description": "Granular Copy progress.", + "properties": { + "storageAccountName": { + "type": "string", + "description": "Name of the storage account. This will be empty for data account types other than storage account.", + "readOnly": true + }, + "transferType": { + "$ref": "#/definitions/TransferType", + "description": "Transfer type of data", + "readOnly": true + }, + "dataAccountType": { + "$ref": "#/definitions/DataAccountType", + "description": "Data Account Type.", + "readOnly": true + }, + "accountId": { + "type": "string", + "description": "Id of the account where the data needs to be uploaded.", + "readOnly": true + }, + "bytesProcessed": { + "type": "integer", + "format": "int64", + "description": "To indicate bytes transferred.", + "readOnly": true + }, + "totalBytesToProcess": { + "type": "integer", + "format": "int64", + "description": "Total amount of data to be processed by the job.", + "readOnly": true + }, + "filesProcessed": { + "type": "integer", + "format": "int64", + "description": "Number of files processed", + "readOnly": true + }, + "totalFilesToProcess": { + "type": "integer", + "format": "int64", + "description": "Total files to process", + "readOnly": true + }, + "invalidFilesProcessed": { + "type": "integer", + "format": "int64", + "description": "Number of files not adhering to azure naming conventions which were processed by automatic renaming", + "readOnly": true + }, + "invalidFileBytesUploaded": { + "type": "integer", + "format": "int64", + "description": "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + "readOnly": true + }, + "renamedContainerCount": { + "type": "integer", + "format": "int64", + "description": "Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + "readOnly": true + }, + "filesErroredOut": { + "type": "integer", + "format": "int64", + "description": "Number of files which could not be copied", + "readOnly": true + }, + "directoriesErroredOut": { + "type": "integer", + "format": "int64", + "description": "To indicate directories errored out in the job.", + "readOnly": true + }, + "invalidDirectoriesProcessed": { + "type": "integer", + "format": "int64", + "description": "To indicate directories renamed", + "readOnly": true + }, + "isEnumerationInProgress": { + "type": "boolean", + "description": "To indicate if enumeration of data is in progress.\nUntil this is true, the TotalBytesToProcess may not be valid.", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error, if any, in the stage", + "readOnly": true + }, + "actions": { + "type": "array", + "description": "Available actions on the job.", + "items": { + "$ref": "#/definitions/CustomerResolutionCode" + }, + "readOnly": true + } + } + }, + "HardwareEncryption": { + "type": "string", + "description": "Hardware encryption support for a given sku for a given region.", + "enum": [ + "Enabled", + "Disabled" + ], + "x-ms-enum": { + "name": "HardwareEncryption", + "modelAsString": false, + "values": [ + { + "name": "Enabled", + "value": "Enabled", + "description": "Hardware-based encryption is enabled." + }, + { + "name": "Disabled", + "value": "Disabled", + "description": "Hardware-based encryption is disabled." + } + ] + } + }, + "HeavyScheduleAvailabilityRequest": { + "type": "object", + "description": "Request body to get the availability for scheduling heavy orders.", + "allOf": [ + { + "$ref": "#/definitions/ScheduleAvailabilityRequest" + } + ], + "x-ms-discriminator-value": "DataBoxHeavy" + }, + "IdentityProperties": { + "type": "object", + "description": "Managed identity properties.", + "properties": { + "type": { + "type": "string", + "description": "Managed service identity type." + }, + "userAssigned": { + "$ref": "#/definitions/UserAssignedProperties", + "description": "User assigned identity properties." + } + } + }, + "ImportDiskDetails": { + "type": "object", + "description": "Import disk details", + "properties": { + "manifestFile": { + "type": "string", + "description": "The relative path of the manifest file on the disk." + }, + "manifestHash": { + "type": "string", + "description": "The Base16-encoded MD5 hash of the manifest file on the disk." + }, + "bitLockerKey": { + "type": "string", + "format": "password", + "description": "BitLocker key used to encrypt the disk.", + "x-ms-secret": true + }, + "backupManifestCloudPath": { + "type": "string", + "description": "Path to backed up manifest, only returned if enableManifestBackup is true.", + "readOnly": true + } + }, + "required": [ + "manifestFile", + "manifestHash", + "bitLockerKey" + ] + }, + "JobDelayDetails": { + "type": "object", + "description": "Job Delay Notification details", + "properties": { + "status": { + "$ref": "#/definitions/DelayNotificationStatus", + "description": "Status of notification", + "readOnly": true + }, + "errorCode": { + "$ref": "#/definitions/PortalDelayErrorCode", + "description": "Delay Error code", + "readOnly": true + }, + "description": { + "type": "string", + "description": "Description of the delay.", + "readOnly": true + }, + "startTime": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the delay notification was created.", + "readOnly": true + }, + "resolutionTime": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the delay notification was resolved.", + "readOnly": true + } + } + }, + "JobDeliveryInfo": { + "type": "object", + "description": "Additional delivery info.", + "properties": { + "scheduledDateTime": { + "type": "string", + "format": "date-time", + "description": "Scheduled date time." + } + } + }, + "JobDeliveryType": { + "type": "string", + "description": "Delivery type of Job.", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsString": false, + "values": [ + { + "name": "NonScheduled", + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "name": "Scheduled", + "value": "Scheduled", + "description": "Scheduled job." + } + ] + } + }, + "JobDetails": { + "type": "object", + "description": "Job details.", + "properties": { + "jobStages": { + "type": "array", + "description": "List of stages that run in the job.", + "items": { + "$ref": "#/definitions/JobStages" + }, + "readOnly": true + }, + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deliveryPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Delivery package shipping details.", + "readOnly": true + }, + "returnPackage": { + "$ref": "#/definitions/PackageShippingDetails", + "description": "Return package shipping details.", + "readOnly": true + }, + "dataImportDetails": { + "type": "array", + "description": "Details of the data to be imported into azure.", + "items": { + "$ref": "#/definitions/DataImportDetails" + } + }, + "dataExportDetails": { + "type": "array", + "description": "Details of the data to be exported from azure.", + "items": { + "$ref": "#/definitions/DataExportDetails" + } + }, + "jobDetailsType": { + "$ref": "#/definitions/ClassDiscriminator", + "description": "Indicates the type of job details." + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences for the order." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails", + "description": "Optional Reverse Shipping details for order." + }, + "copyLogDetails": { + "type": "array", + "description": "List of copy log details.", + "items": { + "$ref": "#/definitions/CopyLogDetails" + }, + "readOnly": true + }, + "reverseShipmentLabelSasKey": { + "type": "string", + "description": "Shared access key to download the return shipment label", + "readOnly": true + }, + "chainOfCustodySasKey": { + "type": "string", + "description": "Shared access key to download the chain of custody logs", + "readOnly": true + }, + "deviceErasureDetails": { + "$ref": "#/definitions/DeviceErasureDetails", + "description": "Holds device data erasure details", + "readOnly": true + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Details about which key encryption type is being used." + }, + "expectedDataSizeInTeraBytes": { + "type": "integer", + "format": "int32", + "description": "The expected size of the data, which needs to be transferred in this job, in terabytes." + }, + "actions": { + "type": "array", + "description": "Available actions on the job.", + "items": { + "$ref": "#/definitions/CustomerResolutionCode" + }, + "readOnly": true + }, + "lastMitigationActionOnJob": { + "$ref": "#/definitions/LastMitigationActionOnJob", + "description": "Last mitigation action performed on the job.", + "readOnly": true + }, + "datacenterAddress": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address to ship to, for the given sku and storage location.", + "readOnly": true + }, + "dataCenterCode": { + "$ref": "#/definitions/DataCenterCode", + "description": "DataCenter code.", + "readOnly": true + } + }, + "discriminator": "jobDetailsType", + "required": [ + "contactDetails", + "jobDetailsType" + ] + }, + "JobProperties": { + "type": "object", + "description": "Job Properties", + "properties": { + "transferType": { + "$ref": "#/definitions/TransferType", + "description": "Type of the data transfer." + }, + "isCancellable": { + "type": "boolean", + "description": "Describes whether the job is cancellable or not.", + "readOnly": true + }, + "isDeletable": { + "type": "boolean", + "description": "Describes whether the job is deletable or not.", + "readOnly": true + }, + "isShippingAddressEditable": { + "type": "boolean", + "description": "Describes whether the shipping address is editable or not.", + "readOnly": true + }, + "reverseShippingDetailsUpdate": { + "$ref": "#/definitions/ReverseShippingDetailsEditStatus", + "description": "The Editable status for Reverse Shipping Address and Contact Info", + "readOnly": true + }, + "reverseTransportPreferenceUpdate": { + "$ref": "#/definitions/ReverseTransportPreferenceEditStatus", + "description": "The Editable status for Reverse Transport preferences", + "readOnly": true + }, + "isPrepareToShipEnabled": { + "type": "boolean", + "description": "Is Prepare To Ship Enabled on this job", + "readOnly": true + }, + "status": { + "$ref": "#/definitions/StageName", + "description": "Name of the stage which is in progress.", + "readOnly": true + }, + "delayedStage": { + "$ref": "#/definitions/StageName", + "description": "Name of the stage where delay might be present.", + "readOnly": true + }, + "startTime": { + "type": "string", + "format": "date-time", + "description": "Time at which the job was started in UTC ISO 8601 format.", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Top level error for the job.", + "readOnly": true + }, + "details": { + "$ref": "#/definitions/JobDetails", + "description": "Details of a job run. This field will only be sent for expand details filter." + }, + "cancellationReason": { + "type": "string", + "description": "Reason for cancellation.", + "readOnly": true + }, + "deliveryType": { + "type": "string", + "description": "Delivery type of Job.", + "default": "NonScheduled", + "enum": [ + "NonScheduled", + "Scheduled" + ], + "x-ms-enum": { + "name": "JobDeliveryType", + "modelAsString": false, + "values": [ + { + "name": "NonScheduled", + "value": "NonScheduled", + "description": "Non Scheduled job." + }, + { + "name": "Scheduled", + "value": "Scheduled", + "description": "Scheduled job." + } + ] + } + }, + "deliveryInfo": { + "$ref": "#/definitions/JobDeliveryInfo", + "description": "Delivery Info of Job." + }, + "isCancellableWithoutFee": { + "type": "boolean", + "description": "Flag to indicate cancellation of scheduled job.", + "readOnly": true + }, + "allDevicesLost": { + "type": "boolean", + "description": "Flag to indicate if all devices associated with the job are lost.", + "readOnly": true + } + }, + "required": [ + "transferType" + ] + }, + "JobResource": { + "type": "object", + "description": "Job Resource.", + "properties": { + "properties": { + "$ref": "#/definitions/JobProperties", + "description": "Properties of a job.", + "x-ms-client-flatten": true + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The sku type." + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + }, + "required": [ + "properties", + "sku" + ], + "allOf": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/definitions/TrackedResource" + } + ] + }, + "JobResourceList": { + "type": "object", + "description": "Job Resource Collection", + "properties": { + "value": { + "type": "array", + "description": "The JobResource items on this page", + "items": { + "$ref": "#/definitions/JobResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "JobResourceUpdateParameter": { + "type": "object", + "description": "The JobResourceUpdateParameter.", + "properties": { + "properties": { + "$ref": "#/definitions/UpdateJobProperties", + "description": "Properties of a job to be updated.", + "x-ms-client-flatten": true + }, + "tags": { + "type": "object", + "description": "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + "additionalProperties": { + "type": "string" + } + }, + "identity": { + "$ref": "#/definitions/ResourceIdentity", + "description": "Msi identity of the resource" + } + } + }, + "JobSecrets": { + "type": "object", + "description": "The base class for the secrets", + "properties": { + "jobSecretsType": { + "$ref": "#/definitions/ClassDiscriminator", + "description": "Used to indicate what type of job secrets object." + }, + "dcAccessSecurityCode": { + "$ref": "#/definitions/DcAccessSecurityCode", + "description": "Dc Access Security Code for Customer Managed Shipping", + "readOnly": true + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error while fetching the secrets.", + "readOnly": true + } + }, + "discriminator": "jobSecretsType", + "required": [ + "jobSecretsType" + ] + }, + "JobStages": { + "type": "object", + "description": "Job stages.", + "properties": { + "stageName": { + "$ref": "#/definitions/StageName", + "description": "Name of the job stage.", + "readOnly": true + }, + "displayName": { + "type": "string", + "description": "Display name of the job stage.", + "readOnly": true + }, + "stageStatus": { + "$ref": "#/definitions/StageStatus", + "description": "Status of the job stage.", + "readOnly": true + }, + "stageTime": { + "type": "string", + "format": "date-time", + "description": "Time for the job stage in UTC ISO 8601 format.", + "readOnly": true + }, + "jobStageDetails": { + "description": "Job Stage Details", + "readOnly": true + }, + "delayInformation": { + "type": "array", + "description": "Delay information for the job stages.", + "items": { + "$ref": "#/definitions/JobDelayDetails" + }, + "readOnly": true, + "x-ms-identifiers": [] + } + } + }, + "KekType": { + "type": "string", + "description": "Type of encryption key used for key encryption.", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "x-ms-enum": { + "name": "KekType", + "modelAsString": false, + "values": [ + { + "name": "MicrosoftManaged", + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "name": "CustomerManaged", + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + } + }, + "KeyEncryptionKey": { + "type": "object", + "description": "Encryption key containing details about key to encrypt different keys.", + "properties": { + "kekType": { + "type": "string", + "description": "Type of encryption key used for key encryption.", + "default": "MicrosoftManaged", + "enum": [ + "MicrosoftManaged", + "CustomerManaged" + ], + "x-ms-enum": { + "name": "KekType", + "modelAsString": false, + "values": [ + { + "name": "MicrosoftManaged", + "value": "MicrosoftManaged", + "description": "Key encryption key is managed by Microsoft." + }, + { + "name": "CustomerManaged", + "value": "CustomerManaged", + "description": "Key encryption key is managed by the Customer." + } + ] + } + }, + "identityProperties": { + "$ref": "#/definitions/IdentityProperties", + "description": "Managed identity properties used for key encryption." + }, + "kekUrl": { + "type": "string", + "description": "Key encryption key. It is required in case of Customer managed KekType." + }, + "kekVaultResourceID": { + "type": "string", + "description": "Kek vault resource id. It is required in case of Customer managed KekType." + } + }, + "required": [ + "kekType" + ] + }, + "LastMitigationActionOnJob": { + "type": "object", + "description": "Last Mitigation Action Performed On Job", + "properties": { + "actionDateTimeInUtc": { + "type": "string", + "format": "date-time", + "description": "Action performed date time" + }, + "isPerformedByCustomer": { + "type": "boolean", + "description": "Action performed by customer,\npossibility is that mitigation might happen by customer or service or by ops" + }, + "customerResolution": { + "$ref": "#/definitions/CustomerResolutionCode", + "description": "Resolution code provided by customer" + } + } + }, + "LogCollectionLevel": { + "type": "string", + "description": "Level of the logs to be collected.", + "enum": [ + "Error", + "Verbose" + ], + "x-ms-enum": { + "name": "LogCollectionLevel", + "modelAsString": false, + "values": [ + { + "name": "Error", + "value": "Error", + "description": "Only Errors will be collected in the logs." + }, + { + "name": "Verbose", + "value": "Verbose", + "description": "Verbose logging (includes Errors, CRC, size information and others)." + } + ] + } + }, + "ManagedDiskDetails": { + "type": "object", + "description": "Details of the managed disks.", + "properties": { + "resourceGroupId": { + "type": "string", + "description": "Resource Group Id of the compute disks." + }, + "stagingStorageAccountId": { + "type": "string", + "description": "Resource Id of the storage account that can be used to copy the vhd for staging." + } + }, + "required": [ + "resourceGroupId", + "stagingStorageAccountId" + ], + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "x-ms-discriminator-value": "ManagedDisk" + }, + "MarkDevicesShippedRequest": { + "type": "object", + "description": "The request body to provide the delivery package details of job", + "properties": { + "deliverToDcPackageDetails": { + "$ref": "#/definitions/PackageCarrierInfo", + "description": "Delivery package details" + } + }, + "required": [ + "deliverToDcPackageDetails" + ] + }, + "MitigateJobRequest": { + "type": "object", + "description": "The Mitigate Job captured from request body for Mitigate API", + "properties": { + "customerResolutionCode": { + "$ref": "#/definitions/CustomerResolutionCode", + "description": "Resolution code for the job" + }, + "serialNumberCustomerResolutionMap": { + "type": "object", + "description": "Serial number and the customer resolution code corresponding to each serial number", + "additionalProperties": { + "$ref": "#/definitions/CustomerResolutionCode" + } + } + } + }, + "ModelName": { + "type": "string", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk", + "AzureDataBox120", + "AzureDataBox525" + ], + "x-ms-enum": { + "name": "ModelName", + "modelAsString": false, + "values": [ + { + "name": "DataBox", + "value": "DataBox", + "description": "Data Box." + }, + { + "name": "DataBoxDisk", + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "name": "DataBoxHeavy", + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "name": "DataBoxCustomerDisk", + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + }, + { + "name": "AzureDataBox120", + "value": "AzureDataBox120", + "description": "Data Box V2 with 120TB usable capacity." + }, + { + "name": "AzureDataBox525", + "value": "AzureDataBox525", + "description": "Data Box V2 with 525TB usable capacity." + } + ] + } + }, + "NotificationPreference": { + "type": "object", + "description": "Notification preference for a job stage.", + "properties": { + "stageName": { + "$ref": "#/definitions/NotificationStageName", + "description": "Name of the stage." + }, + "sendNotification": { + "type": "boolean", + "description": "Notification is required or not.", + "default": true + } + }, + "required": [ + "stageName", + "sendNotification" + ] + }, + "NotificationStageName": { + "type": "string", + "description": "Name of the stage.", + "enum": [ + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Created", + "ShippedToCustomer" + ], + "x-ms-enum": { + "name": "NotificationStageName", + "modelAsString": true, + "values": [ + { + "name": "DevicePrepared", + "value": "DevicePrepared", + "description": "Notification at device prepared stage." + }, + { + "name": "Dispatched", + "value": "Dispatched", + "description": "Notification at device dispatched stage." + }, + { + "name": "Delivered", + "value": "Delivered", + "description": "Notification at device delivered stage." + }, + { + "name": "PickedUp", + "value": "PickedUp", + "description": "Notification at device picked up from user stage." + }, + { + "name": "AtAzureDC", + "value": "AtAzureDC", + "description": "Notification at device received at Azure datacenter stage." + }, + { + "name": "DataCopy", + "value": "DataCopy", + "description": "Notification at data copy started stage." + }, + { + "name": "Created", + "value": "Created", + "description": "Notification at job created stage." + }, + { + "name": "ShippedToCustomer", + "value": "ShippedToCustomer", + "description": "Notification at shipped devices to customer stage." + } + ] + } + }, + "Operation": { + "type": "object", + "description": "Operation entity.", + "properties": { + "name": { + "type": "string", + "description": "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + "readOnly": true + }, + "display": { + "$ref": "#/definitions/OperationDisplay", + "description": "Operation display values.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/OperationProperties", + "description": "Operation properties.", + "readOnly": true, + "x-ms-client-flatten": true + }, + "origin": { + "type": "string", + "description": "Origin of the operation. Can be : user|system|user,system", + "readOnly": true + }, + "isDataAction": { + "type": "boolean", + "description": "Indicates whether the operation is a data action" + } + } + }, + "OperationDisplay": { + "type": "object", + "description": "Operation display", + "properties": { + "provider": { + "type": "string", + "description": "Provider name." + }, + "resource": { + "type": "string", + "description": "Resource name." + }, + "operation": { + "type": "string", + "description": "Localized name of the operation for display purpose." + }, + "description": { + "type": "string", + "description": "Localized description of the operation for display purpose." + } + } + }, + "OperationList": { + "type": "object", + "description": "The paginated list of connected cluster API operations.", + "properties": { + "value": { + "type": "array", + "description": "The list of connected cluster API operations.", + "items": { + "$ref": "#/definitions/Operation" + }, + "readOnly": true + }, + "nextLink": { + "type": "string", + "description": "The link to fetch the next page of connected cluster API operations." + } + } + }, + "OperationProperties": { + "type": "object", + "description": "Operation properties." + }, + "OverallValidationStatus": { + "type": "string", + "description": "Overall validation status.", + "enum": [ + "AllValidToProceed", + "InputsRevisitRequired", + "CertainInputValidationsSkipped" + ], + "x-ms-enum": { + "name": "OverallValidationStatus", + "modelAsString": false, + "values": [ + { + "name": "AllValidToProceed", + "value": "AllValidToProceed", + "description": "Every input request is valid." + }, + { + "name": "InputsRevisitRequired", + "value": "InputsRevisitRequired", + "description": "Some input requests are not valid." + }, + { + "name": "CertainInputValidationsSkipped", + "value": "CertainInputValidationsSkipped", + "description": "Certain input validations skipped." + } + ] + } + }, + "PackageCarrierDetails": { + "type": "object", + "description": "Package carrier details.", + "properties": { + "carrierAccountNumber": { + "type": "string", + "format": "password", + "description": "Carrier Account Number of customer for customer disk.", + "x-ms-secret": true + }, + "carrierName": { + "type": "string", + "description": "Name of the carrier." + }, + "trackingId": { + "type": "string", + "description": "Tracking Id of shipment." + } + } + }, + "PackageCarrierInfo": { + "type": "object", + "description": "package carrier info", + "properties": { + "carrierName": { + "type": "string", + "description": "Name of the carrier." + }, + "trackingId": { + "type": "string", + "description": "Tracking Id of shipment." + } + } + }, + "PackageShippingDetails": { + "type": "object", + "description": "package shipping details", + "properties": { + "trackingUrl": { + "type": "string", + "description": "Url where shipment can be tracked.", + "readOnly": true + }, + "carrierName": { + "type": "string", + "description": "Name of the carrier.", + "readOnly": true + }, + "trackingId": { + "type": "string", + "description": "Tracking Id of shipment.", + "readOnly": true + } + } + }, + "PortalDelayErrorCode": { + "type": "string", + "description": "Delay Error code", + "enum": [ + "InternalIssueDelay", + "ActiveOrderLimitBreachedDelay", + "HighDemandDelay", + "LargeNumberOfFilesDelay" + ], + "x-ms-enum": { + "name": "PortalDelayErrorCode", + "modelAsString": true, + "values": [ + { + "name": "InternalIssueDelay", + "value": "InternalIssueDelay", + "description": "Delay due to any internal reasons" + }, + { + "name": "ActiveOrderLimitBreachedDelay", + "value": "ActiveOrderLimitBreachedDelay", + "description": "Active Order limit breached." + }, + { + "name": "HighDemandDelay", + "value": "HighDemandDelay", + "description": "High demand" + }, + { + "name": "LargeNumberOfFilesDelay", + "value": "LargeNumberOfFilesDelay", + "description": "Slow copy due to large number of files" + } + ] + } + }, + "Preferences": { + "type": "object", + "description": "Preferences related to the order", + "properties": { + "preferredDataCenterRegion": { + "type": "array", + "description": "Preferred data center region.", + "items": { + "type": "string" + } + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "reverseTransportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Optional Preferences related to the reverse shipment logistics of the sku." + }, + "encryptionPreferences": { + "$ref": "#/definitions/EncryptionPreferences", + "description": "Preferences related to the Encryption." + }, + "storageAccountAccessTierPreferences": { + "type": "array", + "description": "Preferences related to the Access Tier of storage accounts.", + "items": { + "type": "string", + "enum": [ + "Archive" + ], + "x-ms-enum": { + "modelAsString": false + } + } + } + } + }, + "PreferencesValidationRequest": { + "type": "object", + "description": "Request to validate preference of transport and data center.", + "properties": { + "preference": { + "$ref": "#/definitions/Preferences", + "description": "Preference of transport and data center." + }, + "deviceType": { + "$ref": "#/definitions/SkuName", + "description": "Device type to be used for the job." + }, + "model": { + "$ref": "#/definitions/ModelName", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025" + } + }, + "required": [ + "deviceType" + ], + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "x-ms-discriminator-value": "ValidatePreferences" + }, + "PreferencesValidationResponseProperties": { + "type": "object", + "description": "Properties of data center and transport preference validation response.", + "properties": { + "status": { + "$ref": "#/definitions/ValidationStatus", + "description": "Validation status of requested data center and transport.", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "x-ms-discriminator-value": "ValidatePreferences" + }, + "RegionConfigurationRequest": { + "type": "object", + "description": "Request body to get the configuration for the region.", + "properties": { + "scheduleAvailabilityRequest": { + "$ref": "#/definitions/ScheduleAvailabilityRequest", + "description": "Request body to get the availability for scheduling orders." + }, + "transportAvailabilityRequest": { + "$ref": "#/definitions/TransportAvailabilityRequest", + "description": "Request body to get the transport availability for given sku." + }, + "datacenterAddressRequest": { + "$ref": "#/definitions/DatacenterAddressRequest", + "description": "Request body to get the datacenter address for given sku." + }, + "deviceCapabilityRequest": { + "$ref": "#/definitions/DeviceCapabilityRequest", + "description": "Request body to get the device capabilities for a given sku." + } + } + }, + "RegionConfigurationResponse": { + "type": "object", + "description": "Configuration response specific to a region.", + "properties": { + "scheduleAvailabilityResponse": { + "$ref": "#/definitions/ScheduleAvailabilityResponse", + "description": "Schedule availability for given sku in a region.", + "readOnly": true + }, + "transportAvailabilityResponse": { + "$ref": "#/definitions/TransportAvailabilityResponse", + "description": "Transport options available for given sku in a region.", + "readOnly": true + }, + "datacenterAddressResponse": { + "$ref": "#/definitions/DatacenterAddressResponse", + "description": "Datacenter address for given sku in a region.", + "readOnly": true + }, + "deviceCapabilityResponse": { + "$ref": "#/definitions/DeviceCapabilityResponse", + "description": "Device capabilities available for a given sku in a region.", + "readOnly": true + } + } + }, + "ResourceIdentity": { + "type": "object", + "description": "Msi identity details of the resource", + "properties": { + "type": { + "type": "string", + "description": "Identity type", + "default": "None" + }, + "principalId": { + "type": "string", + "description": "Service Principal Id backing the Msi", + "readOnly": true + }, + "tenantId": { + "type": "string", + "description": "Home Tenant Id", + "readOnly": true + }, + "userAssignedIdentities": { + "type": "object", + "description": "User Assigned Identities", + "additionalProperties": { + "$ref": "../../../../../../common-types/resource-management/v3/managedidentity.json#/definitions/UserAssignedIdentity" + } + } + } + }, + "ReverseShippingDetails": { + "type": "object", + "description": "Reverse Shipping Address and contact details for a job.", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactInfo", + "description": "Contact Info." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address where customer wishes to receive the device." + }, + "isUpdated": { + "type": "boolean", + "description": "A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared.\nRead only field", + "readOnly": true + } + } + }, + "ReverseShippingDetailsEditStatus": { + "type": "string", + "description": "The Editable status for Reverse Shipping Address and Contact Info", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "x-ms-enum": { + "name": "ReverseShippingDetailsEditStatus", + "modelAsString": false, + "values": [ + { + "name": "Enabled", + "value": "Enabled", + "description": "Reverse shipping details can be edited." + }, + { + "name": "Disabled", + "value": "Disabled", + "description": "Edit is disabled for Reverse shipping details." + }, + { + "name": "NotSupported", + "value": "NotSupported", + "description": "Edit is not supported for Reverse shipping details. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "ReverseTransportPreferenceEditStatus": { + "type": "string", + "description": "The Editable status for Reverse Transport preferences", + "enum": [ + "Enabled", + "Disabled", + "NotSupported" + ], + "x-ms-enum": { + "name": "ReverseTransportPreferenceEditStatus", + "modelAsString": false, + "values": [ + { + "name": "Enabled", + "value": "Enabled", + "description": "Reverse Transport Preferences can be edited." + }, + { + "name": "Disabled", + "value": "Disabled", + "description": "Edit is disabled for Reverse Transport Preferences." + }, + { + "name": "NotSupported", + "value": "NotSupported", + "description": "Edit is not supported for Reverse Transport Preferences. Either subscription feature is not available or SKU doesn't support this feature." + } + ] + } + }, + "ScheduleAvailabilityRequest": { + "type": "object", + "description": "Request body to get the availability for scheduling orders.", + "properties": { + "storageLocation": { + "type": "string", + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01" + }, + "skuName": { + "$ref": "#/definitions/SkuName", + "description": "Sku Name for which the order is to be scheduled." + }, + "country": { + "type": "string", + "description": "Country in which storage location should be supported." + }, + "model": { + "$ref": "#/definitions/ModelName", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025" + } + }, + "discriminator": "skuName", + "required": [ + "storageLocation", + "skuName" + ] + }, + "ScheduleAvailabilityResponse": { + "type": "object", + "description": "Schedule availability for given sku in a region.", + "properties": { + "availableDates": { + "type": "array", + "description": "List of dates available to schedule", + "items": { + "type": "string", + "format": "date-time" + }, + "readOnly": true + } + } + }, + "ShareCredentialDetails": { + "type": "object", + "description": "Credential details of the shares in account.", + "properties": { + "shareName": { + "type": "string", + "description": "Name of the share.", + "readOnly": true + }, + "shareType": { + "$ref": "#/definitions/ShareDestinationFormatType", + "description": "Type of the share.", + "readOnly": true + }, + "userName": { + "type": "string", + "description": "User name for the share.", + "readOnly": true + }, + "password": { + "type": "string", + "description": "Password for the share.", + "readOnly": true + }, + "supportedAccessProtocols": { + "type": "array", + "description": "Access protocols supported on the device.", + "items": { + "$ref": "#/definitions/AccessProtocol" + }, + "readOnly": true + } + } + }, + "ShareDestinationFormatType": { + "type": "string", + "description": "Type of the share.", + "enum": [ + "UnknownType", + "HCS", + "BlockBlob", + "PageBlob", + "AzureFile", + "ManagedDisk" + ], + "x-ms-enum": { + "name": "ShareDestinationFormatType", + "modelAsString": false, + "values": [ + { + "name": "UnknownType", + "value": "UnknownType", + "description": "Unknown format." + }, + { + "name": "HCS", + "value": "HCS", + "description": "Storsimple data format." + }, + { + "name": "BlockBlob", + "value": "BlockBlob", + "description": "Azure storage block blob format." + }, + { + "name": "PageBlob", + "value": "PageBlob", + "description": "Azure storage page blob format." + }, + { + "name": "AzureFile", + "value": "AzureFile", + "description": "Azure storage file format." + }, + { + "name": "ManagedDisk", + "value": "ManagedDisk", + "description": "Azure Compute Disk." + } + ] + } + }, + "ShipmentPickUpRequest": { + "type": "object", + "description": "Shipment pick up request details.", + "properties": { + "startTime": { + "type": "string", + "format": "date-time", + "description": "Minimum date after which the pick up should commence, this must be in local time of pick up area." + }, + "endTime": { + "type": "string", + "format": "date-time", + "description": "Maximum date before which the pick up should commence, this must be in local time of pick up area." + }, + "shipmentLocation": { + "type": "string", + "description": "Shipment Location in the pickup place. Eg.front desk" + } + }, + "required": [ + "startTime", + "endTime", + "shipmentLocation" + ] + }, + "ShipmentPickUpResponse": { + "type": "object", + "description": "Shipment pick up response.", + "properties": { + "confirmationNumber": { + "type": "string", + "description": "Confirmation number for the pick up request.", + "readOnly": true + }, + "readyByTime": { + "type": "string", + "format": "date-time", + "description": "Time by which shipment should be ready for pick up, this is in local time of pick up area.", + "readOnly": true + } + } + }, + "ShippingAddress": { + "type": "object", + "description": "Shipping address where customer wishes to receive the device.", + "properties": { + "streetAddress1": { + "type": "string", + "description": "Street Address line 1." + }, + "streetAddress2": { + "type": "string", + "description": "Street Address line 2." + }, + "streetAddress3": { + "type": "string", + "description": "Street Address line 3." + }, + "city": { + "type": "string", + "description": "Name of the City." + }, + "stateOrProvince": { + "type": "string", + "description": "Name of the State or Province." + }, + "country": { + "type": "string", + "description": "Name of the Country." + }, + "postalCode": { + "type": "string", + "description": "Postal code." + }, + "zipExtendedCode": { + "type": "string", + "description": "Extended Zip Code." + }, + "companyName": { + "type": "string", + "description": "Name of the company." + }, + "addressType": { + "type": "string", + "description": "Type of address.", + "default": "None", + "enum": [ + "None", + "Residential", + "Commercial" + ], + "x-ms-enum": { + "name": "AddressType", + "modelAsString": false, + "values": [ + { + "name": "None", + "value": "None", + "description": "Address type not known." + }, + { + "name": "Residential", + "value": "Residential", + "description": "Residential Address." + }, + { + "name": "Commercial", + "value": "Commercial", + "description": "Commercial Address." + } + ] + } + }, + "skipAddressValidation": { + "type": "boolean", + "description": "Flag to indicate if customer has chosen to skip default address validation" + }, + "taxIdentificationNumber": { + "type": "string", + "description": "Tax Identification Number" + } + }, + "required": [ + "streetAddress1", + "country" + ] + }, + "Sku": { + "type": "object", + "description": "The Sku.", + "properties": { + "name": { + "$ref": "#/definitions/SkuName", + "description": "The sku name." + }, + "displayName": { + "type": "string", + "description": "The display name of the sku." + }, + "family": { + "type": "string", + "description": "The sku family." + }, + "model": { + "$ref": "#/definitions/ModelName", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025" + } + }, + "required": [ + "name" + ] + }, + "SkuAvailabilityValidationRequest": { + "type": "object", + "description": "Request to validate sku availability.", + "properties": { + "deviceType": { + "$ref": "#/definitions/SkuName", + "description": "Device type to be used for the job." + }, + "transferType": { + "$ref": "#/definitions/TransferType", + "description": "Type of the transfer." + }, + "country": { + "type": "string", + "description": "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements" + }, + "location": { + "type": "string", + "description": "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01" + }, + "model": { + "$ref": "#/definitions/ModelName", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025" + } + }, + "required": [ + "deviceType", + "transferType", + "country", + "location" + ], + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuAvailabilityValidationResponseProperties": { + "type": "object", + "description": "Properties of sku availability validation response.", + "properties": { + "status": { + "$ref": "#/definitions/ValidationStatus", + "description": "Sku availability validation status.", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "x-ms-discriminator-value": "ValidateSkuAvailability" + }, + "SkuCapacity": { + "type": "object", + "description": "Capacity of the sku.", + "properties": { + "usable": { + "type": "string", + "description": "Usable capacity in TB.", + "readOnly": true + }, + "maximum": { + "type": "string", + "description": "Maximum capacity in TB.", + "readOnly": true + }, + "individualSkuUsable": { + "type": "string", + "description": "Maximum capacity per device in TB.", + "readOnly": true + } + } + }, + "SkuCost": { + "type": "object", + "description": "Describes metadata for retrieving price info.", + "properties": { + "meterId": { + "type": "string", + "description": "Meter id of the Sku.", + "readOnly": true + }, + "meterType": { + "type": "string", + "description": "The type of the meter.", + "readOnly": true + }, + "multiplier": { + "type": "number", + "format": "double", + "description": "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + "readOnly": true + } + } + }, + "SkuDisabledReason": { + "type": "string", + "description": "Reason why the Sku is disabled.", + "enum": [ + "None", + "Country", + "Region", + "Feature", + "OfferType", + "NoSubscriptionInfo" + ], + "x-ms-enum": { + "name": "SkuDisabledReason", + "modelAsString": false, + "values": [ + { + "name": "None", + "value": "None", + "description": "SKU is not disabled." + }, + { + "name": "Country", + "value": "Country", + "description": "SKU is not available in the requested country." + }, + { + "name": "Region", + "value": "Region", + "description": "SKU is not available to push data to the requested Azure region." + }, + { + "name": "Feature", + "value": "Feature", + "description": "Required features are not enabled for the SKU." + }, + { + "name": "OfferType", + "value": "OfferType", + "description": "Subscription does not have required offer types for the SKU." + }, + { + "name": "NoSubscriptionInfo", + "value": "NoSubscriptionInfo", + "description": "Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification." + } + ] + } + }, + "SkuInformation": { + "type": "object", + "description": "Information of the sku.", + "properties": { + "sku": { + "$ref": "#/definitions/Sku", + "description": "The Sku.", + "readOnly": true + }, + "enabled": { + "type": "boolean", + "description": "The sku is enabled or not.", + "readOnly": true + }, + "properties": { + "$ref": "#/definitions/SkuProperties", + "description": "Properties of the sku.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "SkuName": { + "type": "string", + "description": "SKU names.", + "enum": [ + "DataBox", + "DataBoxDisk", + "DataBoxHeavy", + "DataBoxCustomerDisk" + ], + "x-ms-enum": { + "name": "SkuName", + "modelAsString": false, + "values": [ + { + "name": "DataBox", + "value": "DataBox", + "description": "Data Box." + }, + { + "name": "DataBoxDisk", + "value": "DataBoxDisk", + "description": "Data Box Disk." + }, + { + "name": "DataBoxHeavy", + "value": "DataBoxHeavy", + "description": "Data Box Heavy." + }, + { + "name": "DataBoxCustomerDisk", + "value": "DataBoxCustomerDisk", + "description": "Data Box Customer Disk" + } + ] + } + }, + "SkuProperties": { + "type": "object", + "description": "Properties of the sku.", + "properties": { + "dataLocationToServiceLocationMap": { + "type": "array", + "description": "The map of data location to service location.", + "items": { + "$ref": "#/definitions/DataLocationToServiceLocationMap" + }, + "readOnly": true + }, + "capacity": { + "$ref": "#/definitions/SkuCapacity", + "description": "Capacity of the Sku.", + "readOnly": true + }, + "costs": { + "type": "array", + "description": "Cost of the Sku.", + "items": { + "$ref": "#/definitions/SkuCost" + }, + "readOnly": true + }, + "apiVersions": { + "type": "array", + "description": "Api versions that support this Sku.", + "items": { + "type": "string" + }, + "readOnly": true + }, + "disabledReason": { + "$ref": "#/definitions/SkuDisabledReason", + "description": "Reason why the Sku is disabled.", + "readOnly": true + }, + "disabledReasonMessage": { + "type": "string", + "description": "Message for why the Sku is disabled.", + "readOnly": true + }, + "requiredFeature": { + "type": "string", + "description": "Required feature to access the sku.", + "readOnly": true + }, + "countriesWithinCommerceBoundary": { + "type": "array", + "description": "List of all the Countries in the SKU specific commerce boundary", + "items": { + "type": "string" + }, + "readOnly": true + } + } + }, + "StageName": { + "type": "string", + "description": "Name of the stage which is in progress.", + "enum": [ + "DeviceOrdered", + "DevicePrepared", + "Dispatched", + "Delivered", + "PickedUp", + "AtAzureDC", + "DataCopy", + "Completed", + "CompletedWithErrors", + "Cancelled", + "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", + "Aborted", + "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", + "ReadyToReceiveAtAzureDC", + "Created", + "ShippedToAzureDC", + "AwaitingShipmentDetails", + "PreparingToShipFromAzureDC", + "ShippedToCustomer" + ], + "x-ms-enum": { + "name": "StageName", + "modelAsString": true, + "values": [ + { + "name": "DeviceOrdered", + "value": "DeviceOrdered", + "description": "An order has been created." + }, + { + "name": "DevicePrepared", + "value": "DevicePrepared", + "description": "A device has been prepared for the order." + }, + { + "name": "Dispatched", + "value": "Dispatched", + "description": "Device has been dispatched to the user of the order." + }, + { + "name": "Delivered", + "value": "Delivered", + "description": "Device has been delivered to the user of the order." + }, + { + "name": "PickedUp", + "value": "PickedUp", + "description": "Device has been picked up from user and in transit to Azure datacenter." + }, + { + "name": "AtAzureDC", + "value": "AtAzureDC", + "description": "Device has been received at Azure datacenter from the user." + }, + { + "name": "DataCopy", + "value": "DataCopy", + "description": "Data copy from the device at Azure datacenter." + }, + { + "name": "Completed", + "value": "Completed", + "description": "Order has completed." + }, + { + "name": "CompletedWithErrors", + "value": "CompletedWithErrors", + "description": "Order has completed with errors." + }, + { + "name": "Cancelled", + "value": "Cancelled", + "description": "Order has been cancelled." + }, + { + "name": "Failed_IssueReportedAtCustomer", + "value": "Failed_IssueReportedAtCustomer", + "description": "Order has failed due to issue reported by user." + }, + { + "name": "Failed_IssueDetectedAtAzureDC", + "value": "Failed_IssueDetectedAtAzureDC", + "description": "Order has failed due to issue detected at Azure datacenter." + }, + { + "name": "Aborted", + "value": "Aborted", + "description": "Order has been aborted." + }, + { + "name": "CompletedWithWarnings", + "value": "CompletedWithWarnings", + "description": "Order has completed with warnings." + }, + { + "name": "ReadyToDispatchFromAzureDC", + "value": "ReadyToDispatchFromAzureDC", + "description": "Device is ready to be handed to customer from Azure DC." + }, + { + "name": "ReadyToReceiveAtAzureDC", + "value": "ReadyToReceiveAtAzureDC", + "description": "Device can be dropped off at Azure DC." + }, + { + "name": "Created", + "value": "Created", + "description": "Job created by the customer." + }, + { + "name": "ShippedToAzureDC", + "value": "ShippedToAzureDC", + "description": "User shipped the device to AzureDC." + }, + { + "name": "AwaitingShipmentDetails", + "value": "AwaitingShipmentDetails", + "description": "Awaiting shipment details of device from customer." + }, + { + "name": "PreparingToShipFromAzureDC", + "value": "PreparingToShipFromAzureDC", + "description": "Preparing the device to ship to customer." + }, + { + "name": "ShippedToCustomer", + "value": "ShippedToCustomer", + "description": "Shipped the device to customer." + } + ] + } + }, + "StageStatus": { + "type": "string", + "description": "Holds the device erasure completion status", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Cancelled", + "Cancelling", + "SucceededWithErrors", + "WaitingForCustomerAction", + "SucceededWithWarnings", + "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", + "CustomerActionPerformedForCleanUp", + "CustomerActionPerformed" + ], + "x-ms-enum": { + "name": "StageStatus", + "modelAsString": false, + "values": [ + { + "name": "None", + "value": "None", + "description": "No status available yet." + }, + { + "name": "InProgress", + "value": "InProgress", + "description": "Stage is in progress." + }, + { + "name": "Succeeded", + "value": "Succeeded", + "description": "Stage has succeeded." + }, + { + "name": "Failed", + "value": "Failed", + "description": "Stage has failed." + }, + { + "name": "Cancelled", + "value": "Cancelled", + "description": "Stage has been cancelled." + }, + { + "name": "Cancelling", + "value": "Cancelling", + "description": "Stage is cancelling." + }, + { + "name": "SucceededWithErrors", + "value": "SucceededWithErrors", + "description": "Stage has succeeded with errors." + }, + { + "name": "WaitingForCustomerAction", + "value": "WaitingForCustomerAction", + "description": "Stage is stuck until customer takes some action." + }, + { + "name": "SucceededWithWarnings", + "value": "SucceededWithWarnings", + "description": "Stage has succeeded with warnings." + }, + { + "name": "WaitingForCustomerActionForKek", + "value": "WaitingForCustomerActionForKek", + "description": "Stage is waiting for customer action for kek action items." + }, + { + "name": "WaitingForCustomerActionForCleanUp", + "value": "WaitingForCustomerActionForCleanUp", + "description": "Stage is waiting for customer action for clean up." + }, + { + "name": "CustomerActionPerformedForCleanUp", + "value": "CustomerActionPerformedForCleanUp", + "description": "Stage has performed customer action for clean up." + }, + { + "name": "CustomerActionPerformed", + "value": "CustomerActionPerformed", + "description": "Stage has performed customer action for clean up." + } + ] + }, + "readOnly": true + }, + "StorageAccountDetails": { + "type": "object", + "description": "Details for the storage account.", + "properties": { + "storageAccountId": { + "type": "string", + "description": "Storage Account Resource Id." + } + }, + "required": [ + "storageAccountId" + ], + "allOf": [ + { + "$ref": "#/definitions/DataAccountDetails" + } + ], + "x-ms-discriminator-value": "StorageAccount" + }, + "SubscriptionIsAllowedToCreateJobValidationRequest": { + "type": "object", + "description": "Request to validate subscription permission to create jobs.", + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "SubscriptionIsAllowedToCreateJobValidationResponseProperties": { + "type": "object", + "description": "Properties of subscription permission to create job validation response.", + "properties": { + "status": { + "$ref": "#/definitions/ValidationStatus", + "description": "Validation status of subscription permission to create job.", + "readOnly": true + } + }, + "allOf": [ + { + "$ref": "#/definitions/ValidationInputResponse" + } + ], + "x-ms-discriminator-value": "ValidateSubscriptionIsAllowedToCreateJob" + }, + "TransferAllDetails": { + "type": "object", + "description": "Details to transfer all data.", + "properties": { + "dataAccountType": { + "type": "string", + "description": "Type of the account of data", + "default": "StorageAccount", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "x-ms-enum": { + "name": "DataAccountType", + "modelAsString": false, + "values": [ + { + "name": "StorageAccount", + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "name": "ManagedDisk", + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "transferAllBlobs": { + "type": "boolean", + "description": "To indicate if all Azure blobs have to be transferred" + }, + "transferAllFiles": { + "type": "boolean", + "description": "To indicate if all Azure Files have to be transferred" + } + }, + "required": [ + "dataAccountType" + ] + }, + "TransferConfiguration": { + "type": "object", + "description": "Configuration for defining the transfer of data.", + "properties": { + "transferConfigurationType": { + "$ref": "#/definitions/TransferConfigurationType", + "description": "Type of the configuration for transfer." + }, + "transferFilterDetails": { + "$ref": "#/definitions/TransferConfigurationTransferFilterDetails", + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter." + }, + "transferAllDetails": { + "$ref": "#/definitions/TransferConfigurationTransferAllDetails", + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll" + } + }, + "required": [ + "transferConfigurationType" + ] + }, + "TransferConfigurationTransferAllDetails": { + "type": "object", + "description": "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll", + "properties": { + "include": { + "$ref": "#/definitions/TransferAllDetails", + "description": "Details to transfer all data." + } + } + }, + "TransferConfigurationTransferFilterDetails": { + "type": "object", + "description": "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter.", + "properties": { + "include": { + "$ref": "#/definitions/TransferFilterDetails", + "description": "Details of the filtering the transfer of data." + } + } + }, + "TransferConfigurationType": { + "type": "string", + "description": "Type of the configuration for transfer.", + "enum": [ + "TransferAll", + "TransferUsingFilter" + ], + "x-ms-enum": { + "name": "TransferConfigurationType", + "modelAsString": false, + "values": [ + { + "name": "TransferAll", + "value": "TransferAll", + "description": "Transfer all the data." + }, + { + "name": "TransferUsingFilter", + "value": "TransferUsingFilter", + "description": "Transfer using filter." + } + ] + } + }, + "TransferFilterDetails": { + "type": "object", + "description": "Details of the filtering the transfer of data.", + "properties": { + "dataAccountType": { + "type": "string", + "description": "Type of the account of data.", + "default": "StorageAccount", + "enum": [ + "StorageAccount", + "ManagedDisk" + ], + "x-ms-enum": { + "name": "DataAccountType", + "modelAsString": false, + "values": [ + { + "name": "StorageAccount", + "value": "StorageAccount", + "description": "Storage Accounts ." + }, + { + "name": "ManagedDisk", + "value": "ManagedDisk", + "description": "Azure Managed disk storage." + } + ] + } + }, + "blobFilterDetails": { + "$ref": "#/definitions/BlobFilterDetails", + "description": "Filter details to transfer blobs." + }, + "azureFileFilterDetails": { + "$ref": "#/definitions/AzureFileFilterDetails", + "description": "Filter details to transfer Azure files." + }, + "filterFileDetails": { + "type": "array", + "description": "Details of the filter files to be used for data transfer.", + "items": { + "$ref": "#/definitions/FilterFileDetails" + } + } + }, + "required": [ + "dataAccountType" + ] + }, + "TransferType": { + "type": "string", + "description": "Type of the transfer.", + "enum": [ + "ImportToAzure", + "ExportFromAzure" + ], + "x-ms-enum": { + "name": "TransferType", + "modelAsString": false, + "values": [ + { + "name": "ImportToAzure", + "value": "ImportToAzure", + "description": "Import data to azure." + }, + { + "name": "ExportFromAzure", + "value": "ExportFromAzure", + "description": "Export data from azure." + } + ] + } + }, + "TransportAvailabilityDetails": { + "type": "object", + "description": "Transport options availability details for given region.", + "properties": { + "shipmentType": { + "$ref": "#/definitions/TransportShipmentTypes", + "description": "Transport Shipment Type supported for given region.", + "readOnly": true + } + } + }, + "TransportAvailabilityRequest": { + "type": "object", + "description": "Request body to get the transport availability for given sku.", + "properties": { + "skuName": { + "$ref": "#/definitions/SkuName", + "description": "Type of the device." + }, + "model": { + "$ref": "#/definitions/ModelName", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025" + } + } + }, + "TransportAvailabilityResponse": { + "type": "object", + "description": "Transport options available for given sku in a region.", + "properties": { + "transportAvailabilityDetails": { + "type": "array", + "description": "List of transport availability details for given region", + "items": { + "$ref": "#/definitions/TransportAvailabilityDetails" + }, + "readOnly": true + } + } + }, + "TransportPreferences": { + "type": "object", + "description": "Preferences related to the shipment logistics of the sku", + "properties": { + "preferredShipmentType": { + "$ref": "#/definitions/TransportShipmentTypes", + "description": "Indicates Shipment Logistics type that the customer preferred." + }, + "isUpdated": { + "type": "boolean", + "description": "Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + "readOnly": true + } + }, + "required": [ + "preferredShipmentType" + ] + }, + "TransportShipmentTypes": { + "type": "string", + "description": "Transport Shipment Type supported for given region.", + "enum": [ + "CustomerManaged", + "MicrosoftManaged" + ], + "x-ms-enum": { + "name": "TransportShipmentTypes", + "modelAsString": false, + "values": [ + { + "name": "CustomerManaged", + "value": "CustomerManaged", + "description": "Shipment Logistics is handled by the customer." + }, + { + "name": "MicrosoftManaged", + "value": "MicrosoftManaged", + "description": "Shipment Logistics is handled by Microsoft." + } + ] + } + }, + "UnencryptedCredentials": { + "type": "object", + "description": "Unencrypted credentials for accessing device.", + "properties": { + "jobName": { + "type": "string", + "description": "Name of the job.", + "readOnly": true + }, + "jobSecrets": { + "$ref": "#/definitions/JobSecrets", + "description": "Secrets related to this job.", + "readOnly": true + } + } + }, + "UnencryptedCredentialsList": { + "type": "object", + "description": "List of unencrypted credentials for accessing device.", + "properties": { + "value": { + "type": "array", + "description": "The UnencryptedCredentials items on this page", + "items": { + "$ref": "#/definitions/UnencryptedCredentials" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "UpdateJobDetails": { + "type": "object", + "description": "Job details for update.", + "properties": { + "contactDetails": { + "$ref": "#/definitions/ContactDetails", + "description": "Contact details for notification and shipping." + }, + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "reverseShippingDetails": { + "$ref": "#/definitions/ReverseShippingDetails", + "description": "Reverse Shipping Address and contact details for a job." + }, + "preferences": { + "$ref": "#/definitions/Preferences", + "description": "Preferences related to the order" + }, + "keyEncryptionKey": { + "$ref": "#/definitions/KeyEncryptionKey", + "description": "Key encryption key for the job." + }, + "returnToCustomerPackageDetails": { + "$ref": "#/definitions/PackageCarrierDetails", + "description": "Return package details of job." + } + } + }, + "UpdateJobProperties": { + "type": "object", + "description": "Job Properties for update", + "properties": { + "details": { + "$ref": "#/definitions/UpdateJobDetails", + "description": "Details of a job to be updated." + } + } + }, + "UserAssignedProperties": { + "type": "object", + "description": "User assigned identity properties.", + "properties": { + "resourceId": { + "type": "string", + "description": "Arm resource id for user assigned identity to be used to fetch MSI token." + } + } + }, + "ValidateAddress": { + "type": "object", + "description": "The requirements to validate customer address where the device needs to be shipped.", + "properties": { + "shippingAddress": { + "$ref": "#/definitions/ShippingAddress", + "description": "Shipping address of the customer." + }, + "deviceType": { + "$ref": "#/definitions/SkuName", + "description": "Device type to be used for the job." + }, + "transportPreferences": { + "$ref": "#/definitions/TransportPreferences", + "description": "Preferences related to the shipment logistics of the sku." + }, + "model": { + "$ref": "#/definitions/ModelName", + "description": "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025" + } + }, + "required": [ + "shippingAddress", + "deviceType" + ], + "allOf": [ + { + "$ref": "#/definitions/ValidationInputRequest" + } + ], + "x-ms-discriminator-value": "ValidateAddress" + }, + "ValidationInputDiscriminator": { + "type": "string", + "description": "Identifies the type of validation request.", + "enum": [ + "ValidateAddress", + "ValidateSubscriptionIsAllowedToCreateJob", + "ValidatePreferences", + "ValidateCreateOrderLimit", + "ValidateSkuAvailability", + "ValidateDataTransferDetails" + ], + "x-ms-enum": { + "name": "ValidationInputDiscriminator", + "modelAsString": false, + "values": [ + { + "name": "ValidateAddress", + "value": "ValidateAddress", + "description": "Identify request and response of address validation." + }, + { + "name": "ValidateSubscriptionIsAllowedToCreateJob", + "value": "ValidateSubscriptionIsAllowedToCreateJob", + "description": "Identify request and response for validation of subscription permission to create job." + }, + { + "name": "ValidatePreferences", + "value": "ValidatePreferences", + "description": "Identify request and response of preference validation." + }, + { + "name": "ValidateCreateOrderLimit", + "value": "ValidateCreateOrderLimit", + "description": "Identify request and response of create order limit for subscription validation." + }, + { + "name": "ValidateSkuAvailability", + "value": "ValidateSkuAvailability", + "description": "Identify request and response of active job limit for sku availability." + }, + { + "name": "ValidateDataTransferDetails", + "value": "ValidateDataTransferDetails", + "description": "Identify request and response of data transfer details validation." + } + ] + } + }, + "ValidationInputRequest": { + "type": "object", + "description": "Minimum fields that must be present in any type of validation request.", + "properties": { + "validationType": { + "$ref": "#/definitions/ValidationInputDiscriminator", + "description": "Identifies the type of validation request." + } + }, + "discriminator": "validationType", + "required": [ + "validationType" + ] + }, + "ValidationInputResponse": { + "type": "object", + "description": "Minimum properties that should be present in each individual validation response.", + "properties": { + "validationType": { + "$ref": "#/definitions/ValidationInputDiscriminator", + "description": "Identifies the type of validation response." + }, + "error": { + "$ref": "#/definitions/CloudError", + "description": "Error code and message of validation response.", + "readOnly": true + } + }, + "discriminator": "validationType", + "required": [ + "validationType" + ] + }, + "ValidationRequest": { + "type": "object", + "description": "Minimum request requirement of any validation category.", + "properties": { + "validationCategory": { + "type": "string", + "description": "Identify the nature of validation.", + "enum": [ + "JobCreationValidation" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "individualRequestDetails": { + "type": "array", + "description": "List of request details contain validationType and its request as key and value respectively.", + "items": { + "$ref": "#/definitions/ValidationInputRequest" + } + } + }, + "discriminator": "validationCategory", + "required": [ + "validationCategory", + "individualRequestDetails" + ] + }, + "ValidationResponse": { + "type": "object", + "description": "Response of pre job creation validations.", + "properties": { + "properties": { + "$ref": "#/definitions/ValidationResponseProperties", + "description": "Properties of pre job creation validation response.", + "readOnly": true, + "x-ms-client-flatten": true + } + } + }, + "ValidationResponseProperties": { + "type": "object", + "description": "Properties of pre job creation validation response.", + "properties": { + "status": { + "$ref": "#/definitions/OverallValidationStatus", + "description": "Overall validation status.", + "readOnly": true + }, + "individualResponseDetails": { + "type": "array", + "description": "List of response details contain validationType and its response as key and value respectively.", + "items": { + "$ref": "#/definitions/ValidationInputResponse" + }, + "readOnly": true + } + } + }, + "ValidationStatus": { + "type": "string", + "description": "Create order limit validation status.", + "enum": [ + "Valid", + "Invalid", + "Skipped" + ], + "x-ms-enum": { + "name": "ValidationStatus", + "modelAsString": false, + "values": [ + { + "name": "Valid", + "value": "Valid", + "description": "Validation is successful" + }, + { + "name": "Invalid", + "value": "Invalid", + "description": "Validation is not successful" + }, + { + "name": "Skipped", + "value": "Skipped", + "description": "Validation is skipped" + } + ] + } + } + }, + "parameters": {} +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/suppressions.yaml b/tests-upgrade/tests-emitter/DataBox.Management.brown/suppressions.yaml new file mode 100644 index 00000000000..e0da08c6647 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/suppressions.yaml @@ -0,0 +1,71 @@ +# Suppressions for DataBox service + +# Preview versions +- tool: TypeSpecRequirement + path: ./preview/2021-08-01-preview/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./preview/2024-02-01-preview/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./preview/2024-03-01-preview/*.json + reason: Brownfield service not ready to migrate + +# Stable versions +- tool: TypeSpecRequirement + path: ./stable/2018-01-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2019-09-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2020-04-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2020-11-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2021-03-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2021-05-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2021-12-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2022-02-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2022-09-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2022-10-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2022-12-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2023-03-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2023-12-01/*.json + reason: Brownfield service not ready to migrate + +- tool: TypeSpecRequirement + path: ./stable/2025-02-01/*.json + reason: Brownfield service not ready to migrate diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/.gitattributes b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/.gitattributes similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/.gitattributes rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/.gitattributes diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/Az.DataBox.csproj b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/Az.DataBox.csproj new file mode 100644 index 00000000000..7b2083db2ee --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/Az.DataBox.csproj @@ -0,0 +1,44 @@ + + + + 0.1.0 + 7.1 + netstandard2.0 + Library + Az.DataBox.private + false + Microsoft.Azure.PowerShell.Cmdlets.DataBox + true + false + ./bin + $(OutputPath) + Az.DataBox.nuspec + true + + + 1998, 1591 + true + + + + false + TRACE;DEBUG;NETSTANDARD + + + + true + true + MSSharedLibKey.snk + TRACE;RELEASE;NETSTANDARD;SIGN + + + + + + + + + $(DefaultItemExcludes);resources/** + + + \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/Az.DataBox.nuspec b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/Az.DataBox.nuspec new file mode 100644 index 00000000000..c5fe908ed4a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/Az.DataBox.nuspec @@ -0,0 +1,32 @@ + + + + Az.DataBox + 0.1.0 + Microsoft Corporation + Microsoft Corporation + true + https://aka.ms/azps-license + https://github.com/Azure/azure-powershell + Microsoft Azure PowerShell: DataBox cmdlets + + Microsoft Corporation. All rights reserved. + Azure ResourceManager ARM PSModule DataBox + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/Az.DataBox.psm1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/Az.DataBox.psm1 new file mode 100644 index 00000000000..75e5eac3603 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/Az.DataBox.psm1 @@ -0,0 +1,119 @@ +# region Generated + # ---------------------------------------------------------------------------------- + # Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. + # ---------------------------------------------------------------------------------- + # Load required Az.Accounts module + $accountsName = 'Az.Accounts' + $accountsModule = Get-Module -Name $accountsName + if(-not $accountsModule) { + $localAccountsPath = Join-Path $PSScriptRoot 'generated\modules' + if(Test-Path -Path $localAccountsPath) { + $localAccounts = Get-ChildItem -Path $localAccountsPath -Recurse -Include 'Az.Accounts.psd1' | Select-Object -Last 1 + if($localAccounts) { + $accountsModule = Import-Module -Name ($localAccounts.FullName) -Scope Global -PassThru + } + } + if(-not $accountsModule) { + $hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.7.5' } | Measure-Object).Count -gt 0 + if($hasAdequateVersion) { + $accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.7.5 -Scope Global -PassThru + } + } + } + + if(-not $accountsModule) { + Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop + } elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) { + Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop + } + Write-Information "Loaded Module '$($accountsModule.Name)'" + + # Load the private module dll + $null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.DataBox.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module]::Instance + + # Ask for the shared functionality table + $VTable = Register-AzModule + + # Tweaks the pipeline on module load + $instance.OnModuleLoad = $VTable.OnModuleLoad + + # Following two delegates are added for telemetry + $instance.GetTelemetryId = $VTable.GetTelemetryId + $instance.Telemetry = $VTable.Telemetry + + # Delegate to sanitize the output object + $instance.SanitizeOutput = $VTable.SanitizerHandler + + # Delegate to get the telemetry info + $instance.GetTelemetryInfo = $VTable.GetTelemetryInfo + + # Tweaks the pipeline per call + $instance.OnNewRequest = $VTable.OnNewRequest + + # Gets shared parameter values + $instance.GetParameterValue = $VTable.GetParameterValue + + # Allows shared module to listen to events from this module + $instance.EventListener = $VTable.EventListener + + # Gets shared argument completers + $instance.ArgumentCompleter = $VTable.ArgumentCompleter + + # The name of the currently selected Azure profile + $instance.ProfileName = $VTable.ProfileName + + # Load the custom module + $customModulePath = Join-Path $PSScriptRoot './custom/Az.DataBox.custom.psm1' + if(Test-Path $customModulePath) { + $null = Import-Module -Name $customModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = Join-Path $PSScriptRoot './exports' + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } + + # Finalize initialization of this module + $instance.Init(); + Write-Information "Loaded Module '$($instance.Name)'" +# endregion diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/MSSharedLibKey.snk b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/MSSharedLibKey.snk similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/MSSharedLibKey.snk rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/MSSharedLibKey.snk diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/Properties/AssemblyInfo.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..176e850ee3a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the ""License""); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an ""AS IS"" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +// is regenerated. + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[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 - DataBoxManagementClient")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.0.0")] +[assembly: System.Reflection.AssemblyVersionAttribute("0.1.0.0")] +[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly: System.CLSCompliantAttribute(false)] \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/README.md new file mode 100644 index 00000000000..4e13d10ab8a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/README.md @@ -0,0 +1,24 @@ + +# Az.DataBox +This directory contains the PowerShell module for the DataBox service. + +--- +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.DataBox`, see [how-to.md](how-to.md). + diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/build-module.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/build-module.ps1 new file mode 100644 index 00000000000..16c002025c6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/build-module.ps1 @@ -0,0 +1,191 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [switch]$UX, [Switch]$DisableAfterBuildTasks) +$ErrorActionPreference = 'Stop' + +if($PSEdition -ne 'Core') { + Write-Error 'This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell.' +} + +if(-not $NotIsolated -and -not $Debugger) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated + + if($LastExitCode -ne 0) { + # Build failed. Don't attempt to run the module. + return + } + + if($Test) { + . (Join-Path $PSScriptRoot 'test-module.ps1') + if($LastExitCode -ne 0) { + # Tests failed. Don't attempt to run the module. + return + } + } + + if($Docs) { + . (Join-Path $PSScriptRoot 'generate-help.ps1') + if($LastExitCode -ne 0) { + # Docs generation failed. Don't attempt to run the module. + return + } + } + + if($UX) { + . (Join-Path $PSScriptRoot 'generate-portal-ux.ps1') + if($LastExitCode -ne 0) { + # UX generation failed. Don't attempt to run the module. + return + } + } + + if($Pack) { + . (Join-Path $PSScriptRoot 'pack-module.ps1') + if($LastExitCode -ne 0) { + # Packing failed. Don't attempt to run the module. + return + } + } + + $runModulePath = Join-Path $PSScriptRoot 'run-module.ps1' + if($Code) { + . $runModulePath -Code + } elseif($Run) { + . $runModulePath + } else { + Write-Host -ForegroundColor Cyan "To run this module in an isolated PowerShell session, run the 'run-module.ps1' script or provide the '-Run' parameter to this script." + } + return +} + +$binFolder = Join-Path $PSScriptRoot 'bin' +$objFolder = Join-Path $PSScriptRoot 'obj' + +$isAzure = [System.Convert]::ToBoolean('true') + +if(-not $Debugger) { + Write-Host -ForegroundColor Green 'Cleaning build folders...' + $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Force -Path $binFolder, $objFolder + + if((Test-Path $binFolder) -or (Test-Path $objFolder)) { + Write-Host -ForegroundColor Cyan 'Did you forget to exit your isolated module session before rebuilding?' + Write-Error 'Unable to clean ''bin'' or ''obj'' folder. A process may have an open handle.' + } + + Write-Host -ForegroundColor Green 'Compiling module...' + $buildConfig = 'Debug' + if($Release) { + $buildConfig = 'Release' + } + dotnet publish $PSScriptRoot --verbosity quiet --configuration $buildConfig /nologo + if($LastExitCode -ne 0) { + Write-Error 'Compilation failed.' + } + + $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Force -Path (Join-Path $binFolder 'Debug'), (Join-Path $binFolder 'Release') +} + +$dll = Join-Path $PSScriptRoot 'bin\Az.DataBox.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} + +# Load DLL to use build-time cmdlets +$null = Import-Module -Name $dll + +$modulePaths = $dll +$customPsm1 = Join-Path $PSScriptRoot 'custom\Az.DataBox.custom.psm1' +if(Test-Path $customPsm1) { + $modulePaths = @($dll, $customPsm1) +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(Test-Path $exportsFolder) { + $null = Get-ChildItem -Path $exportsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue -Force +} +$null = New-Item -ItemType Directory -Force -Path $exportsFolder + +$internalFolder = Join-Path $PSScriptRoot 'internal' +if(Test-Path $internalFolder) { + $null = Get-ChildItem -Path $internalFolder -Recurse -Exclude '*.psm1', 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue -Force +} +$null = New-Item -ItemType Directory -Force -Path $internalFolder + +$psd1 = Join-Path $PSScriptRoot './Az.DataBox.psd1' +$guid = Get-ModuleGuid -Psd1Path $psd1 +$moduleName = 'Az.DataBox' +$examplesFolder = Join-Path $PSScriptRoot 'examples' +$null = New-Item -ItemType Directory -Force -Path $examplesFolder + +Write-Host -ForegroundColor Green 'Creating cmdlets for specified models...' +$modelCmdlets = @() +$modelCmdletFolder = Join-Path (Join-Path $PSScriptRoot './custom') 'autogen-model-cmdlets' +if (Test-Path $modelCmdletFolder) { + $null = Remove-Item -Force -Recurse -Path $modelCmdletFolder +} +if ($modelCmdlets.Count -gt 0) { + . (Join-Path $PSScriptRoot 'create-model-cmdlets.ps1') + CreateModelCmdlet($modelCmdlets) +} + +if($NoDocs) { + Write-Host -ForegroundColor Green 'Creating exports...' + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ExcludeDocs -ExamplesFolder $examplesFolder +} else { + Write-Host -ForegroundColor Green 'Creating exports and docs...' + $moduleDescription = 'Microsoft Azure PowerShell: DataBox cmdlets' + $docsFolder = Join-Path $PSScriptRoot 'docs' + if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue -Force + } + $null = New-Item -ItemType Directory -Force -Path $docsFolder + $addComplexInterfaceInfo = !$isAzure + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo +} + +Write-Host -ForegroundColor Green 'Creating format.ps1xml...' +$formatPs1xml = Join-Path $PSScriptRoot './Az.DataBox.format.ps1xml' +Export-FormatPs1xml -FilePath $formatPs1xml + +Write-Host -ForegroundColor Green 'Creating psd1...' +$customFolder = Join-Path $PSScriptRoot 'custom' +Export-Psd1 -ExportsFolder $exportsFolder -CustomFolder $customFolder -Psd1Path $psd1 -ModuleGuid $guid + +Write-Host -ForegroundColor Green 'Creating test stubs...' +$testFolder = Join-Path $PSScriptRoot 'test' +$null = New-Item -ItemType Directory -Force -Path $testFolder +Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFolder $testFolder + +Write-Host -ForegroundColor Green 'Creating example stubs...' +Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder + +if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')) +{ + Write-Host -ForegroundColor Green 'Creating ux metadata...' + . (Join-Path $PSScriptRoot 'generate-portal-ux.ps1') +} + +if (-not $DisableAfterBuildTasks){ + $afterBuildTasksPath = Join-Path $PSScriptRoot '../../../tools/BuildScripts/AdaptAutorestModule.ps1' + $afterBuildTasksArgs = ConvertFrom-Json '{"SubModuleName":"Az.DataBox","ModuleRootName":"$(root-module-name)"}' -AsHashtable + if(Test-Path -Path $afterBuildTasksPath -PathType leaf){ + Write-Host -ForegroundColor Green 'Running after build tasks...' + . $afterBuildTasksPath @afterBuildTasksArgs + } +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/check-dependencies.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/check-dependencies.ps1 similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/check-dependencies.ps1 rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/check-dependencies.ps1 diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/create-model-cmdlets.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/create-model-cmdlets.ps1 new file mode 100644 index 00000000000..c6206531106 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/create-model-cmdlets.ps1 @@ -0,0 +1,263 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +function CreateModelCmdlet { + + param([Hashtable[]]$Models) + + if ($Models.Count -eq 0) + { + return + } + + $ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models' + $OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets' + $null = New-Item -ItemType Directory -Force -Path $OutputDir + if (''.length -gt 0) { + $ModuleName = '' + } else { + $ModuleName = 'Az.DataBox' + } + $CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs + $Content = '' + $null = $CsFiles | ForEach-Object -Process { if ($_.Name.Split('.').count -eq 2 ) + { $Content += get-content $_.fullname -raw + } } + + $Tree = [Microsoft.CodeAnalysis.CSharp.SyntaxFactory]::ParseCompilationUnit($Content) + $Nodes = $Tree.ChildNodes().ChildNodes() + $classConstantMember = @{} + foreach ($Model in $Models) + { + $ModelName = $Model.modelName + $InterfaceNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq "I$ModelName") } + $ClassNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'class') -and ($_.Identifier.value -eq "$ModelName") } + $classConstantMember = @() + foreach ($class in $ClassNode) { + foreach ($member in $class.Members) { + $isConstant = $false + foreach ($attr in $member.AttributeLists) { + $memberName = $attr.Attributes.Name.ToString() + if ($memberName.EndsWith('.Constant')) { + $isConstant = $true + break + } + } + if (($member.Modifiers.ToString() -eq 'public') -and $isConstant) { + $classConstantMember += $member.Identifier.Value + } + } + } + if ($InterfaceNode.count -eq 0) { + continue + } + # through a queue, we iterate all the parent models. + $Queue = @($InterfaceNode) + $visited = @("I$ModelName") + $AllInterfaceNodes = @() + while ($Queue.count -ne 0) + { + $AllInterfaceNodes += $Queue[0] + # Baselist contains the direct parent models. + foreach ($parent in $Queue[0].BaseList.Types) + { + if (($parent.Type.Right.Identifier.Value -ne 'IJsonSerializable') -and (-not $visited.Contains($parent.Type.Right.Identifier.Value))) + { + $Queue = [Array]$Queue + ($Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq $parent.Type.Right.Identifier.Value) }) + $visited = [Array]$visited + $parent.Type.Right.Identifier.Value + } + } + $first, $Queue = $Queue + } + + $Namespace = $InterfaceNode.Parent.Name + $ObjectType = $ModelName + $ObjectTypeWithNamespace = "${Namespace}.${ObjectType}" + $Prefix = 'Az' + # remove duplicated module name + if ($ObjectType.StartsWith('DataBox')) { + $ModulePrefix = '' + } else { + $ModulePrefix = 'DataBox' + } + $OutputPath = Join-Path -ChildPath "New-${Prefix}${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir + + $ParameterDefineScriptList = New-Object System.Collections.Generic.List[string] + $ParameterAssignScriptList = New-Object System.Collections.Generic.List[string] + foreach ($Node in $AllInterfaceNodes) + { + foreach ($Member in $Node.Members) + { + if ($classConstantMember.Contains($Member.Identifier.Value)) { + # skip constant member + continue + } + $Arguments = $Member.AttributeLists.Attributes.ArgumentList.Arguments + $Required = $false + $Description = "" + $Readonly = $False + $mutability = @{Read = $true; Create = $true; Update = $true} + foreach ($Argument in $Arguments) + { + if ($Argument.NameEquals.Name.Identifier.Value -eq "Required") + { + $Required = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Description") + { + $Description = $Argument.Expression.Token.Value.Trim('.').replace('"', '`"') + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Readonly") + { + $Readonly = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Read") + { + $mutability.Read = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Create") + { + $mutability.Create = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Update") + { + $mutability.Update = $Argument.Expression.Token.Value + } + } + if ($Readonly) + { + continue + } + $Identifier = $Member.Identifier.Value + $Type = $Member.Type.ToString().replace('?', '').Split("::")[-1] + if ($Type.StartsWith("System.Collections.Generic.List")) + { + # if the type is a list, we need to convert it to array + $matched = $Type -match '\<(?.+)\>$' + if ($matched) + { + $Type = $matches.Name + '[]'; + } + } + $ParameterDefinePropertyList = New-Object System.Collections.Generic.List[string] + if ($Required -and $mutability.Create -and $mutability.Update) + { + $ParameterDefinePropertyList.Add("Mandatory") + } + if ($Description -ne "") + { + $ParameterDefinePropertyList.Add("HelpMessage=`"${Description}.`"") + } + $ParameterDefineProperty = [System.String]::Join(", ", $ParameterDefinePropertyList) + # check whether completer is needed + $completer = ''; + if(IsEnumType($Member)){ + $completer += GetCompleter($Member) + } + $ParameterDefineScript = " + [Parameter($ParameterDefineProperty)]${completer} + [${Type}] + `$${Identifier}" + $ParameterDefineScriptList.Add($ParameterDefineScript) + $ParameterAssignScriptList.Add(" + if (`$PSBoundParameters.ContainsKey('${Identifier}')) { + `$Object.${Identifier} = `$${Identifier} + }") + } + } + $ParameterDefineScript = $ParameterDefineScriptList | Join-String -Separator "," + $ParameterAssignScript = $ParameterAssignScriptList | Join-String -Separator "" + + $cmdletName = "New-${Prefix}${ModulePrefix}${ObjectType}Object" + if ('' -ne $Model.cmdletName) { + $cmdletName = $Model.cmdletName + } + $OutputPath = Join-Path -ChildPath "${cmdletName}.ps1" -Path $OutputDir + $cmdletNameInLowerCase = $cmdletName.ToLower() + $Script = " +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the ""License""); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an ""AS IS"" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for ${ObjectType}. +.Description +Create an in-memory object for ${ObjectType}. + +.Outputs +${ObjectTypeWithNamespace} +.Link +https://learn.microsoft.com/powershell/module/${ModuleName}/${cmdletNameInLowerCase} +#> +function ${cmdletName} { + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.ModelCmdletAttribute()] + [OutputType('${ObjectTypeWithNamespace}')] + [CmdletBinding(PositionalBinding=`$false)] + Param( +${ParameterDefineScript} + ) + + process { + `$Object = [${ObjectTypeWithNamespace}]::New() +${ParameterAssignScript} + return `$Object + } +} +" + Set-Content -Path $OutputPath -Value $Script + } +} + +function IsEnumType { + param ( + [Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax]$property + ) + $isEnum = $false + foreach ($attr in $property.AttributeLists) { + $attributeName = $attr.Attributes.Name.ToString() + if ($attributeName.Contains('ArgumentCompleter')) { + $isEnum = $true + break + } + } + return $isEnum; +} + +function GetCompleter { + param ( + [Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax]$property + ) + foreach ($attr in $property.AttributeLists) { + $attributeName = $attr.Attributes.Name.ToString() + if ($attributeName.Contains('ArgumentCompleter')) { + $attributeName = $attributeName.Split("::")[-1] + $possibleValues = [System.String]::Join(", ", $attr.Attributes.ArgumentList.Arguments) + $completer += "`n [${attributeName}(${possibleValues})]" + return $completer + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/custom/Az.DataBox.custom.psm1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/custom/Az.DataBox.custom.psm1 new file mode 100644 index 00000000000..276025dd4f2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/custom/Az.DataBox.custom.psm1 @@ -0,0 +1,17 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.DataBox.private.dll') + + # Load the internal module + $internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.DataBox.internal.psm1' + if(Test-Path $internalModulePath) { + $null = Import-Module -Name $internalModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export script cmdlets + Get-ChildItem -Path $PSScriptRoot -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + Export-ModuleMember -Function (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot) -Alias (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot -AsAlias) +# endregion diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/custom/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/custom/README.md new file mode 100644 index 00000000000..d85677ccf03 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/custom/README.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.DataBox` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.DataBox.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.DataBox` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. + +For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.DataBox.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. + +For script cmdlets, these are loaded via the `Az.DataBox.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. + +## Purpose +This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder. + +## Usage +The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: +- Break +- DefaultProfile +- HttpPipelineAppend +- HttpPipelinePrepend +- Proxy +- ProxyCredential +- ProxyUseDefaultCredentials + +These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.DataBox`. For C#, follow the usage seen in the `ProcessRecordAsync` method. + +### Attributes +For processing the cmdlets, we've created some additional attributes: +- `Microsoft.Azure.PowerShell.Cmdlets.DataBox.DescriptionAttribute` + - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. +- `Microsoft.Azure.PowerShell.Cmdlets.DataBox.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.DataBox`. +- `Microsoft.Azure.PowerShell.Cmdlets.DataBox.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.DataBox`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.DataBox.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/docs/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/docs/README.md new file mode 100644 index 00000000000..d3266810d5b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/docs/README.md @@ -0,0 +1,11 @@ +# Docs +This directory contains the documentation of the cmdlets for the `Az.DataBox` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `..\examples` folder. + +## Info +- Modifiable: no +- Generated: all +- Committed: yes +- Packaged: yes + +## Details +The process of documentation generation loads `Az.DataBox` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder. \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/examples/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/examples/README.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/examples/README.md rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/examples/README.md diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/export-surface.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/export-surface.ps1 new file mode 100644 index 00000000000..5d244fe3859 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/export-surface.ps1 @@ -0,0 +1,41 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $NotIsolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated + return +} + +$dll = Join-Path $PSScriptRoot 'bin\Az.DataBox.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} +$null = Import-Module -Name $dll + +$moduleName = 'Az.DataBox' +$exportsFolder = Join-Path $PSScriptRoot 'exports' +$resourcesFolder = Join-Path $PSScriptRoot 'resources' + +Export-CmdletSurface -ModuleName $moduleName -CmdletFolder $exportsFolder -OutputFolder $resourcesFolder -IncludeGeneralParameters $IncludeGeneralParameters.IsPresent -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "CmdletSurface file(s) created in '$resourcesFolder'" + +Export-ModelSurface -OutputFolder $resourcesFolder -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "ModelSurface file created in '$resourcesFolder'" + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/exports/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/exports/README.md new file mode 100644 index 00000000000..beb6feb21f5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/exports/README.md @@ -0,0 +1,20 @@ +# Exports +This directory contains the cmdlets *exported by* `Az.DataBox`. No other cmdlets in this repository are directly exported. What that means is the `Az.DataBox` module will run [Export-ModuleMember](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The cmdlets generated here are created every time you run `build-module.ps1`. These cmdlets are a merge of all (excluding `InternalExport`) cmdlets from the private binary (`..\bin\Az.DataBox.private.dll`) and from the `..\custom\Az.DataBox.custom.psm1` module. Cmdlets that are *not merged* from those directories are decorated with the `InternalExport` attribute. This happens when you set the cmdlet to **hide** from configuration. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) or the [README.md](..\internal/README.md) in the `..\internal` folder. + +## Purpose +We generate script cmdlets out of the binary cmdlets and custom cmdlets. The format of script cmdlets are simplistic; thus, easier to generate at build time. Generating the cmdlets is required as to allow merging of generated binary, hand-written binary, and hand-written custom cmdlets. For Azure cmdlets, having script cmdlets simplifies the mechanism for exporting Azure profiles. + +## Structure +The cmdlets generated here will flat in the directory (no sub-folders) as long as there are no Azure profiles specified for any cmdlets. Azure profiles (the `Profiles` attribute) is only applied when generating with the `--azure` attribute (or `azure: true` in the configuration). When Azure profiles are applied, the folder structure has a folder per profile. Each profile folder has only those cmdlets that apply to that profile. + +## Usage +When `./Az.DataBox.psm1` is loaded, it dynamically exports cmdlets here based on the folder structure and on the selected profile. If there are no sub-folders, it exports all cmdlets at the root of this folder. If there are sub-folders, it checks to see the selected profile. If no profile is selected, it exports the cmdlets in the last sub-folder (alphabetically). If a profile is selected, it exports the cmdlets in the sub-folder that matches the profile name. If there is no sub-folder that matches the profile name, it exports no cmdlets and writes a warning message. \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generate-help.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generate-help.ps1 new file mode 100644 index 00000000000..3232c9c4716 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generate-help.ps1 @@ -0,0 +1,74 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $NotIsolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated + return +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(-not (Test-Path $exportsFolder)) { + Write-Error "Exports folder '$exportsFolder' was not found." +} + +$directories = Get-ChildItem -Directory -Path $exportsFolder +$hasProfiles = ($directories | Measure-Object).Count -gt 0 +if(-not $hasProfiles) { + $directories = Get-Item -Path $exportsFolder +} + +$docsFolder = Join-Path $PSScriptRoot 'docs' +if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue -Force +} +$null = New-Item -ItemType Directory -Force -Path $docsFolder -ErrorAction SilentlyContinue +$examplesFolder = Join-Path $PSScriptRoot 'examples' + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.DataBox.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.DataBox.private.dll') +$instance = [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName + +foreach($directory in $directories) +{ + if($hasProfiles) { + Select-AzProfile -Name $directory.Name + } + # Reload module per profile + Import-Module -Name $modulePath -Force + + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $directory.FullName + $cmdletHelpInfo = $cmdletNames | ForEach-Object { Get-Help -Name $_ -Full } + $cmdletFunctionInfo = Get-ScriptCmdlet -ScriptFolder $directory.FullName -AsFunctionInfo + + $docsPath = Join-Path $docsFolder $directory.Name + $null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue + $examplesPath = Join-Path $examplesFolder $directory.Name + $addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true') + Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath -AddComplexInterfaceInfo:$addComplexInterfaceInfo + Write-Host -ForegroundColor Green "Created documentation in '$docsPath'" +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generate-portal-ux.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generate-portal-ux.ps1 new file mode 100644 index 00000000000..9e12efd1445 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generate-portal-ux.ps1 @@ -0,0 +1,383 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# +# This Script will create a folder dedicated to Azure-specific content and includes metadata files essential for enhancing the user experience (UX) within the Azure portal. +# These files are utilized by the Azure portal to effectively present the usage of cmdlets related to specific resources on portal pages. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $NotIsolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated + return +} + +$moduleName = 'Az.DataBox' +$rootModuleName = '' +if ($rootModuleName -eq "") +{ + $rootModuleName = $moduleName +} +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot "./$moduleName.psd1") +$modulePath = $modulePsd1.FullName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot "./bin/$moduleName.private.dll") +$instance = [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName +$parameterSetsInfo = Get-Module -Name "$moduleName.private" + +function Test-FunctionSupported() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [string] + $FunctionName + ) + + If (-not $FunctionName.Contains("_")) { + return $false + } + + $cmdletName, $parameterSetName = $FunctionName.Split("_") + If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity") -or $parameterSetName.Contains("ViaJson")) { + return $false + } + If ($cmdletName.StartsWith("New") -or $cmdletName.StartsWith("Set") -or $cmdletName.StartsWith("Update")) { + return $false + } + + $parameterSetInfo = $parameterSetsInfo.ExportedCmdlets[$FunctionName] + foreach ($parameterInfo in $parameterSetInfo.Parameters.Values) + { + $category = (Get-ParameterAttribute -ParameterInfo $parameterInfo -AttributeName "CategoryAttribute").Categories + $invalideCategory = @('Query', 'Body') + if ($invalideCategory -contains $category) + { + return $false + } + } + + $customFiles = Get-ChildItem -Path custom -Filter "$cmdletName.*" + if ($customFiles.Length -ne 0) + { + Write-Host -ForegroundColor Yellow "There are come custom files for $cmdletName, skip generate UX data for it." + return $false + } + + return $true +} + +function Get-MappedCmdletFromFunctionName() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [string] + $FunctionName + ) + + $cmdletName, $parameterSetName = $FunctionName.Split("_") + + return $cmdletName +} + +function Get-ParameterAttribute() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.ParameterMetadata] + $ParameterInfo, + [Parameter()] + [String] + $AttributeName + ) + return $ParameterInfo.Attributes | Where-Object { $_.TypeId.Name -eq $AttributeName } +} + +function Get-CmdletAttribute() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $CmdletInfo, + [Parameter()] + [String] + $AttributeName + ) + + return $CmdletInfo.ImplementingType.GetTypeInfo().GetCustomAttributes([System.object], $true) | Where-Object { $_.TypeId.Name -eq $AttributeName } +} + +function Get-CmdletDescription() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [String] + $CmdletName + ) + $helpInfo = Get-Help $CmdletName -Full + + $description = $helpInfo.Description.Text + if ($null -eq $description) + { + return "" + } + return $description +} + +# Test whether the parameter is from swagger http path +function Test-ParameterFromSwagger() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.ParameterMetadata] + $ParameterInfo + ) + $category = (Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "CategoryAttribute").Categories + $doNotExport = Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "DoNotExportAttribute" + if ($null -ne $doNotExport) + { + return $false + } + + $valideCategory = @('Path') + if ($valideCategory -contains $category) + { + return $true + } + return $false +} + +function New-ExampleForParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ } + $result = @() + foreach ($parameter in $parameters) + { + $category = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "CategoryAttribute").Categories + $sourceName = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "InfoAttribute").SerializedName + $name = $parameter.Name + $result += [ordered]@{ + name = "-$Name" + value = "[$category.$sourceName]" + } + } + + return $result +} + +function New-ParameterArrayInParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ } + $result = @() + foreach ($parameter in $parameters) + { + $isMandatory = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "ParameterAttribute").Mandatory + $parameterName = $parameter.Name + $parameterType = $parameter.ParameterType.ToString().Split('.')[1] + if ($parameter.SwitchParameter) + { + $parameterSignature = "-$parameterName" + } + else + { + $parameterSignature = "-$parameterName <$parameterType>" + } + if ($parameterName -eq "SubscriptionId") + { + $isMandatory = $false + } + if (-not $isMandatory) + { + $parameterSignature = "[$parameterSignature]" + } + $result += $parameterSignature + } + + return $result +} + +function New-MetadataForParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $httpAttribute = Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "HttpPathAttribute" + $httpPath = $httpAttribute.Path + $apiVersion = $httpAttribute.ApiVersion + $provider = [System.Text.RegularExpressions.Regex]::New("/providers/([\w+\.]+)/").Match($httpPath).Groups[1].Value + $resourcePath = "/" + $httpPath.Split("$provider/")[1] + $resourceType = [System.Text.RegularExpressions.Regex]::New("/([\w]+)/\{\w+\}").Matches($resourcePath) | ForEach-Object {$_.groups[1].Value} | Join-String -Separator "/" + $cmdletName = Get-MappedCmdletFromFunctionName $ParameterSetInfo.Name + $description = (Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "DescriptionAttribute").Description + [object[]]$example = New-ExampleForParameterSet $ParameterSetInfo + if ($Null -eq $example) + { + $example = @() + } + + [string[]]$signature = New-ParameterArrayInParameterSet $ParameterSetInfo + if ($Null -eq $signature) + { + $signature = @() + } + + return @{ + Path = $httpPath + Provider = $provider + ResourceType = $resourceType + ApiVersion = $apiVersion + CmdletName = $cmdletName + Description = $description + Example = $example + Signature = @{ + parameters = $signature + } + } +} + +function Merge-WithExistCmdletMetadata() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Collections.Specialized.OrderedDictionary] + $ExistedCmdletInfo, + [Parameter()] + [Hashtable] + $ParameterSetMetadata + ) + $ExistedCmdletInfo.help.parameterSets += $ParameterSetMetadata.Signature + $ExistedCmdletInfo.examples += [ordered]@{ + description = $ParameterSetMetadata.Description + parameters = $ParameterSetMetadata.Example + } + + return $ExistedCmdletInfo +} + +function New-MetadataForCmdlet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [Hashtable] + $ParameterSetMetadata + ) + $cmdletName = $ParameterSetMetadata.CmdletName + $description = Get-CmdletDescription $cmdletName + $result = [ordered]@{ + name = $cmdletName + description = $description + path = $ParameterSetMetadata.Path + help = [ordered]@{ + learnMore = [ordered]@{ + url = "https://learn.microsoft.com/powershell/module/$rootModuleName/$cmdletName".ToLower() + } + parameterSets = @() + } + examples = @() + } + $result = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $result -ParameterSetMetadata $ParameterSetMetadata + return $result +} + +$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-FunctionSupported($_) } +$resourceTypes = @{} +foreach ($parameterSetName in $parameterSets) +{ + $cmdletInfo = $parameterSetsInfo.ExportedCommands[$parameterSetName] + $parameterSetMetadata = New-MetadataForParameterSet -ParameterSetInfo $cmdletInfo + $cmdletName = $parameterSetMetadata.CmdletName + if (-not ($moduleInfo.ExportedCommands.ContainsKey($cmdletName))) + { + continue + } + if ($resourceTypes.ContainsKey($parameterSetMetadata.ResourceType)) + { + $ExistedCmdletInfo = $resourceTypes[$parameterSetMetadata.ResourceType].commands | Where-Object { $_.name -eq $cmdletName } + if ($ExistedCmdletInfo) + { + $ExistedCmdletInfo = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $ExistedCmdletInfo -ParameterSetMetadata $parameterSetMetadata + } + else + { + $cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata + $resourceTypes[$parameterSetMetadata.ResourceType].commands += $cmdletInfo + } + } + else + { + $cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata + $resourceTypes[$parameterSetMetadata.ResourceType] = [ordered]@{ + resourceType = $parameterSetMetadata.ResourceType + apiVersion = $parameterSetMetadata.ApiVersion + learnMore = @{ + url = "https://learn.microsoft.com/powershell/module/$rootModuleName".ToLower() + } + commands = @($cmdletInfo) + provider = $parameterSetMetadata.Provider + } + } +} + +$UXFolder = 'UX' +if (Test-Path $UXFolder) +{ + Remove-Item -Path $UXFolder -Recurse +} +$null = New-Item -ItemType Directory -Path $UXFolder + +foreach ($resourceType in $resourceTypes.Keys) +{ + $resourceTypeFileName = $resourceType -replace "/", "-" + if ($resourceTypeFileName -eq "") + { + continue + } + $resourceTypeInfo = $resourceTypes[$resourceType] + $provider = $resourceTypeInfo.provider + $providerFolder = "$UXFolder/$provider" + if (-not (Test-Path $providerFolder)) + { + $null = New-Item -ItemType Directory -Path $providerFolder + } + $resourceTypeInfo.Remove("provider") + $resourceTypeInfo | ConvertTo-Json -Depth 10 | Out-File "$providerFolder/$resourceTypeFileName.json" +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/Module.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/Module.cs new file mode 100644 index 00000000000..3ac5f6b9fbf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/Module.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using SendAsyncStepDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + using PipelineChangeDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>; + using GetParameterDelegate = global::System.Func; + using ModuleLoadPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using ArgumentCompleterDelegate = global::System.Func; + using GetTelemetryIdDelegate = global::System.Func; + using TelemetryDelegate = global::System.Action; + using NewRequestPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using SignalDelegate = global::System.Func, global::System.Threading.Tasks.Task>; + using EventListenerDelegate = global::System.Func, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, string, string, global::System.Exception, global::System.Threading.Tasks.Task>; + using NextDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + using SanitizerDelegate = global::System.Action; + using GetTelemetryInfoDelegate = global::System.Func>; + + /// A class that contains the module-common code and data. + public partial class Module + { + /// The currently selected profile. + public string Profile = global::System.String.Empty; + + 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.DataBox.Module _instance; + + /// the ISendAsync pipeline instance + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.HttpPipeline _pipeline; + + /// the ISendAsync pipeline instance (when proxy is enabled) + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + + /// Gets completion data for azure specific fields + public ArgumentCompleterDelegate ArgumentCompleter { get; set; } + + /// The instance of the Client API + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.DataBoxManagementClient ClientAPI { get; set; } + + /// A delegate that gets called for each signalled event + public EventListenerDelegate EventListener { get; set; } + + /// The delegate to call to get parameter data from a common module. + public GetParameterDelegate GetParameterValue { get; set; } + + /// The delegate to get the telemetry Id. + public GetTelemetryIdDelegate GetTelemetryId { get; set; } + + /// The delegate to get the telemetry info. + public GetTelemetryInfoDelegate GetTelemetryInfo { get; set; } + + /// the singleton of this module class + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox"; + + /// The delegate to call when this module is loaded (supporting a commmon module). + public ModuleLoadPipelineDelegate OnModuleLoad { get; set; } + + /// The delegate to call before each new request (supporting a commmon module). + public NewRequestPipelineDelegate OnNewRequest { get; set; } + + /// The name of the currently selected Azure profile + public global::System.String ProfileName { get; set; } + + /// The ResourceID for this module (azure arm). + public string ResourceId => @"Az.DataBox"; + + /// The delegate to call in WriteObject to sanitize the output object. + public SanitizerDelegate SanitizeOutput { get; set; } + + /// The delegate for creating a telemetry. + public TelemetryDelegate Telemetry { get; set; } + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void AfterCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.HttpPipeline pipeline); + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void BeforeCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.HttpPipeline pipeline); + + partial void CustomInit(); + + /// Creates an instance of the HttpPipeline for each call. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the cmdlet's parameterset name. + /// a dict for extensible parameters + /// An instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.HttpPipeline for the remote call. + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.HttpPipeline CreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string processRecordId, string parameterSetName = null, global::System.Collections.Generic.IDictionary extensibleParameters = null) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.HttpPipeline pipeline = null; + BeforeCreatePipeline(invocationInfo, ref pipeline); + pipeline = (pipeline ?? (_useProxy ? _pipelineWithProxy : _pipeline)).Clone(); + AfterCreatePipeline(invocationInfo, ref pipeline); + pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync); + OnNewRequest?.Invoke( invocationInfo, correlationId,processRecordId, (step)=> { pipeline.Prepend(step); } , (step)=> { pipeline.Append(step); } ); + return pipeline; + } + + /// Gets parameters from a common module. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// The name of the parameter to get the value for. + /// + /// The parameter value from the common module. (Note: this should be type converted on the way back) + /// + public object GetParameter(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string parameterName) => GetParameterValue?.Invoke( ResourceId, Name, invocationInfo, correlationId,parameterName ); + + /// Initialization steps performed after the module is loaded. + public void Init() + { + 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. + private Module() + { + // constructor + ClientAPI = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.DataBoxManagementClient(); + _handler.Proxy = _webProxy; + _pipeline = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient())); + _pipelineWithProxy = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient(_handler))); + } + + /// The HTTP Proxy to use. + /// The HTTP Proxy Credentials + /// True if the proxy should use default credentials + public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials) + { + _useProxy = proxy != null; + if (proxy == null) + { + return; + } + // set the proxy configuration + _webProxy.Address = proxy; + _webProxy.BypassProxyOnLocal = false; + if (proxyUseDefaultCredentials) + { + _webProxy.Credentials = null; + _webProxy.UseDefaultCredentials = true; + } + else + { + _webProxy.UseDefaultCredentials = false; + _webProxy.Credentials = proxyCredential ?.GetNetworkCredential(); + } + } + + /// Called to dispatch events to the common module listener + /// The ID of the event + /// The cancellation token for the event + /// A delegate to get the detailed event data + /// The callback for the event dispatcher + /// The from the cmdlet + /// the cmdlet's parameterset name. + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the exception that is being thrown (if available) + /// + /// A that will be complete when handling of the event is completed. + /// + public async global::System.Threading.Tasks.Task Signal(string id, global::System.Threading.CancellationToken token, global::System.Func getEventData, SignalDelegate signal, global::System.Management.Automation.InvocationInfo invocationInfo, string parameterSetName, string correlationId, string processRecordId, global::System.Exception exception) + { + using( NoSynchronizationContext ) + { + await EventListener?.Invoke(id,token,getEventData, signal, invocationInfo, parameterSetName, correlationId,processRecordId,exception); + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/DataBoxManagementClient.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/DataBoxManagementClient.cs new file mode 100644 index 00000000000..bc14541d606 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/DataBoxManagementClient.cs @@ -0,0 +1,7136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Low-level API implementation for the DataBoxManagementClient service. + /// + public partial class DataBoxManagementClient + { + + /// Book shipment pick up. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Details of shipment pick up request. + /// 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.DataBox.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 JobsBookShipmentPickUp(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/bookShipmentPickUp" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsBookShipmentPickUp_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Book shipment pick up. + /// + /// Details of shipment pick up request. + /// 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.DataBox.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 JobsBookShipmentPickUpViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "/bookShipmentPickUp" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsBookShipmentPickUp_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Book shipment pick up. + /// + /// Details of shipment pick up request. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsBookShipmentPickUpViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "/bookShipmentPickUp" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsBookShipmentPickUpWithResult_Call (request, eventListener,sender); + } + } + + /// Book shipment pick up. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Json string supplied to the JobsBookShipmentPickUp 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.DataBox.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 JobsBookShipmentPickUpViaJsonString(string subscriptionId, string resourceGroupName, string jobName, 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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/bookShipmentPickUp" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsBookShipmentPickUp_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Book shipment pick up. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Json string supplied to the JobsBookShipmentPickUp operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsBookShipmentPickUpViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string jobName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/bookShipmentPickUp" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsBookShipmentPickUpWithResult_Call (request, eventListener,sender); + } + } + + /// Book shipment pick up. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Details of shipment pick up request. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsBookShipmentPickUpWithResult(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/bookShipmentPickUp" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsBookShipmentPickUpWithResult_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.DataBox.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 JobsBookShipmentPickUpWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShipmentPickUpResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 JobsBookShipmentPickUp_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShipmentPickUpResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Details of shipment pick up request. + /// 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 JobsBookShipmentPickUp_Validate(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertMinimumLength(nameof(jobName),jobName,3); + await eventListener.AssertMaximumLength(nameof(jobName),jobName,24); + await eventListener.AssertRegEx(nameof(jobName), jobName, @"^[-\w\.]+$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// CancelJob. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Reason for cancellation. + /// 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.DataBox.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 JobsCancel(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason body, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/cancel" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsCancel_Call (request, onNoContent,onDefault,eventListener,sender); + } + } + + /// CancelJob. + /// + /// Reason for cancellation. + /// 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.DataBox.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 JobsCancelViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason body, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "/cancel" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsCancel_Call (request, onNoContent,onDefault,eventListener,sender); + } + } + + /// CancelJob. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Json string supplied to the JobsCancel operation + /// 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.DataBox.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 JobsCancelViaJsonString(string subscriptionId, string resourceGroupName, string jobName, global::System.String jsonString, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/cancel" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsCancel_Call (request, onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsCancel_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Reason for cancellation. + /// 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 JobsCancel_Validate(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertMinimumLength(nameof(jobName),jobName,3); + await eventListener.AssertMaximumLength(nameof(jobName),jobName,24); + await eventListener.AssertRegEx(nameof(jobName), jobName, @"^[-\w\.]+$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// create a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated + /// with the create job API. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Job details from request body. + /// 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.DataBox.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 JobsCreate(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsCreate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// create a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated + /// with the create job API. + /// + /// + /// Job details from request body. + /// 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.DataBox.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 JobsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsCreate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// create a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated + /// with the create job API. + /// + /// + /// Job details from request body. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsCreateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsCreateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// create a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated + /// with the create job API. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Json string supplied to the JobsCreate 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.DataBox.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 JobsCreateViaJsonString(string subscriptionId, string resourceGroupName, string jobName, 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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsCreate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// create a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated + /// with the create job API. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Json string supplied to the JobsCreate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsCreateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string jobName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsCreateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// create a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated + /// with the create job API. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Job details from request body. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsCreateWithResult(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsCreateWithResult_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.DataBox.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 JobsCreateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // declared final-state-via: location + 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.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 JobsCreate_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: location + 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.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Job details from request body. + /// 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 JobsCreate_Validate(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertMinimumLength(nameof(jobName),jobName,3); + await eventListener.AssertMaximumLength(nameof(jobName),jobName,24); + await eventListener.AssertRegEx(nameof(jobName), jobName, @"^[-\w\.]+$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Deletes a job. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// 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.DataBox.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 JobsDelete(string subscriptionId, string resourceGroupName, string jobName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Deletes a job. + /// + /// 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.DataBox.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 JobsDeleteViaIdentity(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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsDelete_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.DataBox.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 JobsDelete_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: location + 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.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// 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 JobsDelete_Validate(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertMinimumLength(nameof(jobName),jobName,3); + await eventListener.AssertMaximumLength(nameof(jobName),jobName,24); + await eventListener.AssertRegEx(nameof(jobName), jobName, @"^[-\w\.]+$"); + } + } + + /// Gets information about the specified job. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// $expand is supported on details parameter for job, which provides details on the job stages. + /// 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.DataBox.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 JobsGet(string subscriptionId, string resourceGroupName, string jobName, string Expand, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Expand) ? global::System.String.Empty : "$expand=" + global::System.Uri.EscapeDataString(Expand)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Gets information about the specified job. + /// + /// $expand is supported on details parameter for job, which provides details on the job stages. + /// 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.DataBox.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 JobsGetViaIdentity(global::System.String viaIdentity, string Expand, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Expand) ? global::System.String.Empty : "$expand=" + global::System.Uri.EscapeDataString(Expand)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Gets information about the specified job. + /// + /// $expand is supported on details parameter for job, which provides details on the job stages. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsGetViaIdentityWithResult(global::System.String viaIdentity, string Expand, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Expand) ? global::System.String.Empty : "$expand=" + global::System.Uri.EscapeDataString(Expand)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Gets information about the specified job. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// $expand is supported on details parameter for job, which provides details on the job stages. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsGetWithResult(string subscriptionId, string resourceGroupName, string jobName, string Expand, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Expand) ? global::System.String.Empty : "$expand=" + global::System.Uri.EscapeDataString(Expand)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsGetWithResult_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.DataBox.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 JobsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 JobsGet_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// $expand is supported on details parameter for job, which provides details on the job stages. + /// 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 JobsGet_Validate(string subscriptionId, string resourceGroupName, string jobName, string Expand, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertMinimumLength(nameof(jobName),jobName,3); + await eventListener.AssertMaximumLength(nameof(jobName),jobName,24); + await eventListener.AssertRegEx(nameof(jobName), jobName, @"^[-\w\.]+$"); + await eventListener.AssertNotNull(nameof(Expand),Expand); + } + } + + /// Lists all the jobs available under the subscription. + /// The ID of the target subscription. The value must be an UUID. + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// 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.DataBox.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 JobsList(string subscriptionId, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/jobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Lists all the jobs available under the given resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// 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.DataBox.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 JobsListByResourceGroup(string subscriptionId, string resourceGroupName, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Lists all the jobs available under the given resource group. + /// + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// 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.DataBox.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 JobsListByResourceGroupViaIdentity(global::System.String viaIdentity, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs$", 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.DataBox/jobs'"); + } + + // 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.DataBox/jobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Lists all the jobs available under the given resource group. + /// + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsListByResourceGroupViaIdentityWithResult(global::System.String viaIdentity, string SkipToken, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs$", 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.DataBox/jobs'"); + } + + // 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.DataBox/jobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsListByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// Lists all the jobs available under the given resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsListByResourceGroupWithResult(string subscriptionId, string resourceGroupName, string SkipToken, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsListByResourceGroupWithResult_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.DataBox.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 JobsListByResourceGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 JobsListByResourceGroup_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// 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 JobsListByResourceGroup_Validate(string subscriptionId, string resourceGroupName, string SkipToken, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(SkipToken),SkipToken); + } + } + + /// This method gets the unencrypted secrets related to the job. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// 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.DataBox.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 JobsListCredentials(string subscriptionId, string resourceGroupName, string jobName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/listCredentials" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsListCredentials_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// This method gets the unencrypted secrets related to the job. + /// + /// 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.DataBox.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 JobsListCredentialsViaIdentity(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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "/listCredentials" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsListCredentials_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// This method gets the unencrypted secrets related to the job. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsListCredentialsViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "/listCredentials" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsListCredentialsWithResult_Call (request, eventListener,sender); + } + } + + /// This method gets the unencrypted secrets related to the job. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsListCredentialsWithResult(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/listCredentials" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsListCredentialsWithResult_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.DataBox.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 JobsListCredentialsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UnencryptedCredentialsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 JobsListCredentials_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UnencryptedCredentialsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// 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 JobsListCredentials_Validate(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertMinimumLength(nameof(jobName),jobName,3); + await eventListener.AssertMaximumLength(nameof(jobName),jobName,24); + await eventListener.AssertRegEx(nameof(jobName), jobName, @"^[-\w\.]+$"); + } + } + + /// Lists all the jobs available under the subscription. + /// + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// 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.DataBox.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 JobsListViaIdentity(global::System.String viaIdentity, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.DataBox/jobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs'"); + } + + // 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.DataBox/jobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Lists all the jobs available under the subscription. + /// + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsListViaIdentityWithResult(global::System.String viaIdentity, string SkipToken, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.DataBox/jobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs'"); + } + + // 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.DataBox/jobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsListWithResult_Call (request, eventListener,sender); + } + } + + /// Lists all the jobs available under the subscription. + /// The ID of the target subscription. The value must be an UUID. + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsListWithResult(string subscriptionId, string SkipToken, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/jobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsListWithResult_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.DataBox.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 JobsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 JobsList_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// 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 JobsList_Validate(string subscriptionId, string SkipToken, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(SkipToken),SkipToken); + } + } + + /// Request to mark devices for a given job as shipped + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Mark Devices Shipped Request + /// 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.DataBox.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 JobsMarkDevicesShipped(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest body, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/markDevicesShipped" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsMarkDevicesShipped_Call (request, onNoContent,onDefault,eventListener,sender); + } + } + + /// Request to mark devices for a given job as shipped + /// + /// Mark Devices Shipped Request + /// 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.DataBox.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 JobsMarkDevicesShippedViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest body, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "/markDevicesShipped" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsMarkDevicesShipped_Call (request, onNoContent,onDefault,eventListener,sender); + } + } + + /// Request to mark devices for a given job as shipped + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Json string supplied to the JobsMarkDevicesShipped operation + /// 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.DataBox.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 JobsMarkDevicesShippedViaJsonString(string subscriptionId, string resourceGroupName, string jobName, global::System.String jsonString, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/markDevicesShipped" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsMarkDevicesShipped_Call (request, onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsMarkDevicesShipped_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Mark Devices Shipped Request + /// 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 JobsMarkDevicesShipped_Validate(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertMinimumLength(nameof(jobName),jobName,3); + await eventListener.AssertMaximumLength(nameof(jobName),jobName,24); + await eventListener.AssertRegEx(nameof(jobName), jobName, @"^[-\w\.]+$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// update the properties of an existing job. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server + /// matches this value. + /// Job update parameters from request body. + /// 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.DataBox.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 JobsUpdate(string subscriptionId, string resourceGroupName, string jobName, string ifMatch, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != ifMatch) + { + request.Headers.Add("If-Match",ifMatch); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update the properties of an existing job. + /// + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server + /// matches this value. + /// Job update parameters from request body. + /// 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.DataBox.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 JobsUpdateViaIdentity(global::System.String viaIdentity, string ifMatch, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != ifMatch) + { + request.Headers.Add("If-Match",ifMatch); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update the properties of an existing job. + /// + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server + /// matches this value. + /// Job update parameters from request body. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsUpdateViaIdentityWithResult(global::System.String viaIdentity, string ifMatch, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // add headers parameters + if (null != ifMatch) + { + request.Headers.Add("If-Match",ifMatch); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// update the properties of an existing job. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server + /// matches this value. + /// Json string supplied to the JobsUpdate 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.DataBox.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 JobsUpdateViaJsonString(string subscriptionId, string resourceGroupName, string jobName, string ifMatch, 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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != ifMatch) + { + request.Headers.Add("If-Match",ifMatch); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update the properties of an existing job. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server + /// matches this value. + /// Json string supplied to the JobsUpdate operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string jobName, string ifMatch, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // add headers parameters + if (null != ifMatch) + { + request.Headers.Add("If-Match",ifMatch); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// update the properties of an existing job. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server + /// matches this value. + /// Job update parameters from request body. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobsUpdateWithResult(string subscriptionId, string resourceGroupName, string jobName, string ifMatch, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // add headers parameters + if (null != ifMatch) + { + request.Headers.Add("If-Match",ifMatch); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.JobsUpdateWithResult_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.DataBox.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 JobsUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + // declared final-state-via: location + 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.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 JobsUpdate_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Progress, "intentional placeholder", 0); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // declared final-state-via: location + 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.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server + /// matches this value. + /// Job update parameters from request body. + /// 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 JobsUpdate_Validate(string subscriptionId, string resourceGroupName, string jobName, string ifMatch, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertMinimumLength(nameof(jobName),jobName,3); + await eventListener.AssertMaximumLength(nameof(jobName),jobName,24); + await eventListener.AssertRegEx(nameof(jobName), jobName, @"^[-\w\.]+$"); + await eventListener.AssertNotNull(nameof(ifMatch),ifMatch); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Request to mitigate for a given job + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Mitigation Request + /// 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.DataBox.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 Mitigate(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest body, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/mitigate" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.Mitigate_Call (request, onNoContent,onDefault,eventListener,sender); + } + } + + /// Request to mitigate for a given job + /// + /// Mitigation Request + /// 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.DataBox.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 MitigateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest body, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/jobs/(?[^/]+)$", 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.DataBox/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/jobs/" + + jobName + + "/mitigate" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.Mitigate_Call (request, onNoContent,onDefault,eventListener,sender); + } + } + + /// Request to mitigate for a given job + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Json string supplied to the Mitigate operation + /// 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.DataBox.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 MitigateViaJsonString(string subscriptionId, string resourceGroupName, string jobName, global::System.String jsonString, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/mitigate" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.Mitigate_Call (request, onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Mitigate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the job Resource within the specified resource group. job names must be between 3 and + /// 24 characters in length and use any alphanumeric and underscore only + /// Mitigation Request + /// 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 Mitigate_Validate(string subscriptionId, string resourceGroupName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertMinimumLength(nameof(jobName),jobName,3); + await eventListener.AssertMaximumLength(nameof(jobName),jobName,24); + await eventListener.AssertRegEx(nameof(jobName), jobName, @"^[-\w\.]+$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// List the operations for the provider + /// 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.DataBox.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.DataBox/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List the operations for the provider + /// + /// 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.DataBox.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.DataBox/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.DataBox/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.DataBox/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List the operations for the provider + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.DataBox/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.DataBox/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.DataBox/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.OperationsListWithResult_Call (request, eventListener,sender); + } + } + + /// List the operations for the provider + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.DataBox/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. + /// + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + + } + } + + /// + /// This method provides the list of available skus for the given subscription, resource group and location. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Filters for showing the available skus. + /// 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.DataBox.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 ServiceListAvailableSkusByResourceGroup(string subscriptionId, string resourceGroupName, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/availableSkus" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceListAvailableSkusByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This method provides the list of available skus for the given subscription, resource group and location. + /// + /// + /// Filters for showing the available skus. + /// 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.DataBox.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 ServiceListAvailableSkusByResourceGroupViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/locations/(?[^/]+)$", 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.DataBox/locations/{location}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/locations/" + + location + + "/availableSkus" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceListAvailableSkusByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This method provides the list of available skus for the given subscription, resource group and location. + /// + /// + /// Filters for showing the available skus. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceListAvailableSkusByResourceGroupViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/locations/(?[^/]+)$", 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.DataBox/locations/{location}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/locations/" + + location + + "/availableSkus" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceListAvailableSkusByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// + /// This method provides the list of available skus for the given subscription, resource group and location. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Json string supplied to the ServiceListAvailableSkusByResourceGroup 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.DataBox.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 ServiceListAvailableSkusByResourceGroupViaJsonString(string subscriptionId, string resourceGroupName, string location, 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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/availableSkus" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceListAvailableSkusByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This method provides the list of available skus for the given subscription, resource group and location. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Json string supplied to the ServiceListAvailableSkusByResourceGroup operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceListAvailableSkusByResourceGroupViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string location, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/availableSkus" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceListAvailableSkusByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// + /// This method provides the list of available skus for the given subscription, resource group and location. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Filters for showing the available skus. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceListAvailableSkusByResourceGroupWithResult(string subscriptionId, string resourceGroupName, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/availableSkus" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceListAvailableSkusByResourceGroupWithResult_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.DataBox.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 ServiceListAvailableSkusByResourceGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AvailableSkusResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 ServiceListAvailableSkusByResourceGroup_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AvailableSkusResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Filters for showing the available skus. + /// 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 ServiceListAvailableSkusByResourceGroup_Validate(string subscriptionId, string resourceGroupName, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertMinimumLength(nameof(location),location,1); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The request body + /// 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.DataBox.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 ServiceRegionConfiguration(string subscriptionId, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/regionConfiguration" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceRegionConfiguration_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Request body to get the configuration for the region at resource group level. + /// 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.DataBox.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 ServiceRegionConfigurationByResourceGroup(string subscriptionId, string resourceGroupName, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/regionConfiguration" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceRegionConfigurationByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// + /// Request body to get the configuration for the region at resource group level. + /// 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.DataBox.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 ServiceRegionConfigurationByResourceGroupViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/locations/(?[^/]+)$", 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.DataBox/locations/{location}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/locations/" + + location + + "/regionConfiguration" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceRegionConfigurationByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// + /// Request body to get the configuration for the region at resource group level. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceRegionConfigurationByResourceGroupViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/locations/(?[^/]+)$", 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.DataBox/locations/{location}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/locations/" + + location + + "/regionConfiguration" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceRegionConfigurationByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Json string supplied to the ServiceRegionConfigurationByResourceGroup 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.DataBox.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 ServiceRegionConfigurationByResourceGroupViaJsonString(string subscriptionId, string resourceGroupName, string location, 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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/regionConfiguration" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceRegionConfigurationByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Json string supplied to the ServiceRegionConfigurationByResourceGroup operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceRegionConfigurationByResourceGroupViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string location, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/regionConfiguration" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceRegionConfigurationByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Request body to get the configuration for the region at resource group level. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceRegionConfigurationByResourceGroupWithResult(string subscriptionId, string resourceGroupName, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/regionConfiguration" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceRegionConfigurationByResourceGroupWithResult_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.DataBox.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 ServiceRegionConfigurationByResourceGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.RegionConfigurationResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 ServiceRegionConfigurationByResourceGroup_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.RegionConfigurationResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Request body to get the configuration for the region at resource group level. + /// 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 ServiceRegionConfigurationByResourceGroup_Validate(string subscriptionId, string resourceGroupName, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertMinimumLength(nameof(location),location,1); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// + /// The request body + /// 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.DataBox.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 ServiceRegionConfigurationViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.DataBox/locations/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.DataBox/locations/" + + location + + "/regionConfiguration" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceRegionConfiguration_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// + /// The request body + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceRegionConfigurationViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.DataBox/locations/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.DataBox/locations/" + + location + + "/regionConfiguration" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceRegionConfigurationWithResult_Call (request, eventListener,sender); + } + } + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// Json string supplied to the ServiceRegionConfiguration 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.DataBox.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 ServiceRegionConfigurationViaJsonString(string subscriptionId, string location, 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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/regionConfiguration" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceRegionConfiguration_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// Json string supplied to the ServiceRegionConfiguration operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceRegionConfigurationViaJsonStringWithResult(string subscriptionId, string location, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/regionConfiguration" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceRegionConfigurationWithResult_Call (request, eventListener,sender); + } + } + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The request body + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceRegionConfigurationWithResult(string subscriptionId, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/regionConfiguration" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceRegionConfigurationWithResult_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.DataBox.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 ServiceRegionConfigurationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.RegionConfigurationResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 ServiceRegionConfiguration_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.RegionConfigurationResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the Azure region. + /// The request body + /// 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 ServiceRegionConfiguration_Validate(string subscriptionId, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertMinimumLength(nameof(location),location,1); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide + /// alternate addresses if any. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The request body + /// 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.DataBox.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 ServiceValidateAddress(string subscriptionId, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/validateAddress" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceValidateAddress_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide + /// alternate addresses if any. + /// + /// + /// The request body + /// 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.DataBox.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 ServiceValidateAddressViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.DataBox/locations/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.DataBox/locations/" + + location + + "/validateAddress" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceValidateAddress_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide + /// alternate addresses if any. + /// + /// + /// The request body + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceValidateAddressViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.DataBox/locations/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.DataBox/locations/" + + location + + "/validateAddress" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceValidateAddressWithResult_Call (request, eventListener,sender); + } + } + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide + /// alternate addresses if any. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// Json string supplied to the ServiceValidateAddress 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.DataBox.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 ServiceValidateAddressViaJsonString(string subscriptionId, string location, 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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/validateAddress" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceValidateAddress_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide + /// alternate addresses if any. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// Json string supplied to the ServiceValidateAddress operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceValidateAddressViaJsonStringWithResult(string subscriptionId, string location, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/validateAddress" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceValidateAddressWithResult_Call (request, eventListener,sender); + } + } + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide + /// alternate addresses if any. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The request body + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceValidateAddressWithResult(string subscriptionId, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/validateAddress" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceValidateAddressWithResult_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.DataBox.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 ServiceValidateAddressWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AddressValidationOutput.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 ServiceValidateAddress_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AddressValidationOutput.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the Azure region. + /// The request body + /// 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 ServiceValidateAddress_Validate(string subscriptionId, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertMinimumLength(nameof(location),location,1); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// This method does all necessary pre-job creation validation under subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The request body + /// 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.DataBox.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 ServiceValidateInputs(string subscriptionId, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/validateInputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceValidateInputs_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Inputs of the customer. + /// 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.DataBox.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 ServiceValidateInputsByResourceGroup(string subscriptionId, string resourceGroupName, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/validateInputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceValidateInputsByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// + /// Inputs of the customer. + /// 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.DataBox.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 ServiceValidateInputsByResourceGroupViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/locations/(?[^/]+)$", 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.DataBox/locations/{location}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/locations/" + + location + + "/validateInputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceValidateInputsByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// + /// Inputs of the customer. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceValidateInputsByResourceGroupViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataBox/locations/(?[^/]+)$", 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.DataBox/locations/{location}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataBox/locations/" + + location + + "/validateInputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceValidateInputsByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Json string supplied to the ServiceValidateInputsByResourceGroup 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.DataBox.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 ServiceValidateInputsByResourceGroupViaJsonString(string subscriptionId, string resourceGroupName, string location, 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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/validateInputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceValidateInputsByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Json string supplied to the ServiceValidateInputsByResourceGroup operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceValidateInputsByResourceGroupViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string location, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/validateInputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceValidateInputsByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Inputs of the customer. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceValidateInputsByResourceGroupWithResult(string subscriptionId, string resourceGroupName, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/validateInputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceValidateInputsByResourceGroupWithResult_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.DataBox.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 ServiceValidateInputsByResourceGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 ServiceValidateInputsByResourceGroup_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Azure region. + /// Inputs of the customer. + /// 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 ServiceValidateInputsByResourceGroup_Validate(string subscriptionId, string resourceGroupName, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.AssertRegEx(nameof(resourceGroupName), resourceGroupName, @"^[-\w\._\(\)]+$"); + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertMinimumLength(nameof(location),location,1); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// This method does all necessary pre-job creation validation under subscription. + /// + /// The request body + /// 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.DataBox.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 ServiceValidateInputsViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.DataBox/locations/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.DataBox/locations/" + + location + + "/validateInputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceValidateInputs_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// This method does all necessary pre-job creation validation under subscription. + /// + /// The request body + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceValidateInputsViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.DataBox/locations/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.DataBox/locations/" + + location + + "/validateInputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceValidateInputsWithResult_Call (request, eventListener,sender); + } + } + + /// This method does all necessary pre-job creation validation under subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// Json string supplied to the ServiceValidateInputs 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.DataBox.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 ServiceValidateInputsViaJsonString(string subscriptionId, string location, 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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/validateInputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ServiceValidateInputs_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// This method does all necessary pre-job creation validation under subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// Json string supplied to the ServiceValidateInputs operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceValidateInputsViaJsonStringWithResult(string subscriptionId, string location, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/validateInputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceValidateInputsWithResult_Call (request, eventListener,sender); + } + } + + /// This method does all necessary pre-job creation validation under subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The request body + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 ServiceValidateInputsWithResult(string subscriptionId, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2025-07-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataBox/locations/" + + global::System.Uri.EscapeDataString(location) + + "/validateInputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.ServiceValidateInputsWithResult_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.DataBox.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 ServiceValidateInputsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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 ServiceValidateInputs_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.DataBox.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 value must be an UUID. + /// The name of the Azure region. + /// The request body + /// 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 ServiceValidateInputs_Validate(string subscriptionId, string location, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest body, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertMinimumLength(nameof(location),location,1); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.PowerShell.cs new file mode 100644 index 00000000000..b5ad53c7477 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Credential details of the account. + [System.ComponentModel.TypeConverter(typeof(AccountCredentialDetailsTypeConverter))] + public partial class AccountCredentialDetails + { + + /// + /// 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 AccountCredentialDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).AccountName = (string) content.GetValueForProperty("AccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).AccountName, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountConnectionString")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).AccountConnectionString = (string) content.GetValueForProperty("AccountConnectionString",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).AccountConnectionString, global::System.Convert.ToString); + } + if (content.Contains("ShareCredentialDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).ShareCredentialDetail = (System.Collections.Generic.List) content.GetValueForProperty("ShareCredentialDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).ShareCredentialDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShareCredentialDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AccountCredentialDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).AccountName = (string) content.GetValueForProperty("AccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).AccountName, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountConnectionString")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).AccountConnectionString = (string) content.GetValueForProperty("AccountConnectionString",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).AccountConnectionString, global::System.Convert.ToString); + } + if (content.Contains("ShareCredentialDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).ShareCredentialDetail = (System.Collections.Generic.List) content.GetValueForProperty("ShareCredentialDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal)this).ShareCredentialDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShareCredentialDetailsTypeConverter.ConvertFrom)); + } + 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.DataBox.Models.IAccountCredentialDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AccountCredentialDetails(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.DataBox.Models.IAccountCredentialDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AccountCredentialDetails(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.DataBox.Models.IAccountCredentialDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Credential details of the account. + [System.ComponentModel.TypeConverter(typeof(AccountCredentialDetailsTypeConverter))] + public partial interface IAccountCredentialDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.TypeConverter.cs new file mode 100644 index 00000000000..743007a7aaf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AccountCredentialDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AccountCredentialDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AccountCredentialDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AccountCredentialDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.cs new file mode 100644 index 00000000000..c9c3554c592 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Credential details of the account. + public partial class AccountCredentialDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal + { + + /// Backing field for property. + private string _accountConnectionString; + + /// + /// Connection string of the account endpoint to use the account as a storage endpoint on the device. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string AccountConnectionString { get => this._accountConnectionString; } + + /// Backing field for property. + private string _accountName; + + /// Name of the account. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string AccountName { get => this._accountName; } + + /// Backing field for property. + private string _dataAccountType; + + /// Type of the account. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DataAccountType { get => this._dataAccountType; } + + /// Internal Acessors for AccountConnectionString + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal.AccountConnectionString { get => this._accountConnectionString; set { {_accountConnectionString = value;} } } + + /// Internal Acessors for AccountName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal.AccountName { get => this._accountName; set { {_accountName = value;} } } + + /// Internal Acessors for DataAccountType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal.DataAccountType { get => this._dataAccountType; set { {_dataAccountType = value;} } } + + /// Internal Acessors for ShareCredentialDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetailsInternal.ShareCredentialDetail { get => this._shareCredentialDetail; set { {_shareCredentialDetail = value;} } } + + /// Backing field for property. + private System.Collections.Generic.List _shareCredentialDetail; + + /// Per share level unencrypted access credentials. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List ShareCredentialDetail { get => this._shareCredentialDetail; } + + /// Creates an new instance. + public AccountCredentialDetails() + { + + } + } + /// Credential details of the account. + public partial interface IAccountCredentialDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// + /// Connection string of the account endpoint to use the account as a storage endpoint on the device. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Connection string of the account endpoint to use the account as a storage endpoint on the device.", + SerializedName = @"accountConnectionString", + PossibleTypes = new [] { typeof(string) })] + string AccountConnectionString { get; } + /// Name of the account. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the account.", + SerializedName = @"accountName", + PossibleTypes = new [] { typeof(string) })] + string AccountName { get; } + /// Type of the account. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Type of the account.", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string DataAccountType { get; } + /// Per share level unencrypted access credentials. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Per share level unencrypted access credentials.", + SerializedName = @"shareCredentialDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetails) })] + System.Collections.Generic.List ShareCredentialDetail { get; } + + } + /// Credential details of the account. + internal partial interface IAccountCredentialDetailsInternal + + { + /// + /// Connection string of the account endpoint to use the account as a storage endpoint on the device. + /// + string AccountConnectionString { get; set; } + /// Name of the account. + string AccountName { get; set; } + /// Type of the account. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string DataAccountType { get; set; } + /// Per share level unencrypted access credentials. + System.Collections.Generic.List ShareCredentialDetail { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.json.cs new file mode 100644 index 00000000000..d9b36d41a4e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AccountCredentialDetails.json.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Credential details of the account. + public partial class AccountCredentialDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal AccountCredentialDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_accountName = If( json?.PropertyT("accountName"), out var __jsonAccountName) ? (string)__jsonAccountName : (string)_accountName;} + {_dataAccountType = If( json?.PropertyT("dataAccountType"), out var __jsonDataAccountType) ? (string)__jsonDataAccountType : (string)_dataAccountType;} + {_accountConnectionString = If( json?.PropertyT("accountConnectionString"), out var __jsonAccountConnectionString) ? (string)__jsonAccountConnectionString : (string)_accountConnectionString;} + {_shareCredentialDetail = If( json?.PropertyT("shareCredentialDetails"), out var __jsonShareCredentialDetails) ? If( __jsonShareCredentialDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IShareCredentialDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShareCredentialDetails.FromJson(__u) )) ))() : null : _shareCredentialDetail;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new AccountCredentialDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._accountName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._accountName.ToString()) : null, "accountName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._dataAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._dataAccountType.ToString()) : null, "dataAccountType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._accountConnectionString)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._accountConnectionString.ToString()) : null, "accountConnectionString" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._shareCredentialDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._shareCredentialDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("shareCredentialDetails",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.PowerShell.cs new file mode 100644 index 00000000000..f92278c3315 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.PowerShell.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Additional information of the type of error. + [System.ComponentModel.TypeConverter(typeof(AdditionalErrorInfoTypeConverter))] + public partial class AdditionalErrorInfo + { + + /// + /// 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 AdditionalErrorInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AdditionalErrorInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + 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.DataBox.Models.IAdditionalErrorInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AdditionalErrorInfo(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.DataBox.Models.IAdditionalErrorInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AdditionalErrorInfo(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.DataBox.Models.IAdditionalErrorInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Additional information of the type of error. + [System.ComponentModel.TypeConverter(typeof(AdditionalErrorInfoTypeConverter))] + public partial interface IAdditionalErrorInfo + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.TypeConverter.cs new file mode 100644 index 00000000000..4fc2b9fe50c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AdditionalErrorInfoTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AdditionalErrorInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AdditionalErrorInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AdditionalErrorInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.cs new file mode 100644 index 00000000000..b7e889cb6a9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Additional information of the type of error. + public partial class AdditionalErrorInfo : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfoInternal + { + + /// Creates an new instance. + public AdditionalErrorInfo() + { + + } + } + /// Additional information of the type of error. + public partial interface IAdditionalErrorInfo : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + + } + /// Additional information of the type of error. + internal partial interface IAdditionalErrorInfoInternal + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.dictionary.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.dictionary.cs new file mode 100644 index 00000000000..3a6af8b1d06 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.dictionary.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class AdditionalErrorInfo : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public global::System.Object this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, global::System.Object value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out global::System.Object value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.json.cs new file mode 100644 index 00000000000..e8d674cc150 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo.json.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Additional information of the type of error. + public partial class AdditionalErrorInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + /// + internal AdditionalErrorInfo(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.DeserializeDictionary(()=>new global::System.Collections.Generic.Dictionary()),exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new AdditionalErrorInfo(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.PowerShell.cs new file mode 100644 index 00000000000..5519698c7bb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// This class represents additional info which Resource Providers pass when an error occurs. + /// + [System.ComponentModel.TypeConverter(typeof(AdditionalErrorInfo1TypeConverter))] + public partial class AdditionalErrorInfo1 + { + + /// + /// 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 AdditionalErrorInfo1(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Info")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1Internal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1Internal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfoTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1Internal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1Internal)this).Type, 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 AdditionalErrorInfo1(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Info")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1Internal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1Internal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfoTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1Internal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1Internal)this).Type, 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.DataBox.Models.IAdditionalErrorInfo1 DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AdditionalErrorInfo1(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.DataBox.Models.IAdditionalErrorInfo1 DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AdditionalErrorInfo1(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.DataBox.Models.IAdditionalErrorInfo1 FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// This class represents additional info which Resource Providers pass when an error occurs. + [System.ComponentModel.TypeConverter(typeof(AdditionalErrorInfo1TypeConverter))] + public partial interface IAdditionalErrorInfo1 + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.TypeConverter.cs new file mode 100644 index 00000000000..2e880b710d9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AdditionalErrorInfo1TypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1 ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AdditionalErrorInfo1.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AdditionalErrorInfo1.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AdditionalErrorInfo1.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.cs new file mode 100644 index 00000000000..9372198e0ce --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// This class represents additional info which Resource Providers pass when an error occurs. + /// + public partial class AdditionalErrorInfo1 : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1Internal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo _info; + + /// Additional information of the type of error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo()); set => this._info = value; } + + /// Backing field for property. + private string _type; + + /// Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation). + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public AdditionalErrorInfo1() + { + + } + } + /// This class represents additional info which Resource Providers pass when an error occurs. + public partial interface IAdditionalErrorInfo1 : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Additional information of the type of error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Additional information of the type of error.", + SerializedName = @"info", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo Info { get; set; } + /// Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation). + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation).", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + + } + /// This class represents additional info which Resource Providers pass when an error occurs. + internal partial interface IAdditionalErrorInfo1Internal + + { + /// Additional information of the type of error. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo Info { get; set; } + /// Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation). + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.json.cs new file mode 100644 index 00000000000..00c78046e40 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AdditionalErrorInfo1.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// This class represents additional info which Resource Providers pass when an error occurs. + /// + public partial class AdditionalErrorInfo1 + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal AdditionalErrorInfo1(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_info = If( json?.PropertyT("info"), out var __jsonInfo) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo.FromJson(__jsonInfo) : _info;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1 FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new AdditionalErrorInfo1(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._info ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._info.ToJson(null,serializationMode) : null, "info" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.PowerShell.cs new file mode 100644 index 00000000000..d661f0d471f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.PowerShell.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Output of the address validation api. + [System.ComponentModel.TypeConverter(typeof(AddressValidationOutputTypeConverter))] + public partial class AddressValidationOutput + { + + /// + /// 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 AddressValidationOutput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AddressValidationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).ValidationType, global::System.Convert.ToString); + } + if (content.Contains("ValidationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).ValidationStatus = (string) content.GetValueForProperty("ValidationStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).ValidationStatus, global::System.Convert.ToString); + } + if (content.Contains("AlternateAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).AlternateAddress = (System.Collections.Generic.List) content.GetValueForProperty("AlternateAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).AlternateAddress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Target, 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 AddressValidationOutput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AddressValidationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).ValidationType, global::System.Convert.ToString); + } + if (content.Contains("ValidationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).ValidationStatus = (string) content.GetValueForProperty("ValidationStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).ValidationStatus, global::System.Convert.ToString); + } + if (content.Contains("AlternateAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).AlternateAddress = (System.Collections.Generic.List) content.GetValueForProperty("AlternateAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).AlternateAddress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal)this).Target, 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.DataBox.Models.IAddressValidationOutput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AddressValidationOutput(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.DataBox.Models.IAddressValidationOutput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AddressValidationOutput(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.DataBox.Models.IAddressValidationOutput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Output of the address validation api. + [System.ComponentModel.TypeConverter(typeof(AddressValidationOutputTypeConverter))] + public partial interface IAddressValidationOutput + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.TypeConverter.cs new file mode 100644 index 00000000000..4456ed999b9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AddressValidationOutputTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AddressValidationOutput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AddressValidationOutput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AddressValidationOutput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.cs new file mode 100644 index 00000000000..aa5ce22df18 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Output of the address validation api. + public partial class AddressValidationOutput : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutput, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal + { + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).AdditionalInfo; } + + /// List of alternate addresses. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AlternateAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)Property).AlternateAddress; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Code; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Detail; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for AlternateAddress + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal.AlternateAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)Property).AlternateAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)Property).AlternateAddress = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Code = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Error = value ?? null /* model class */; } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Message = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AddressValidationProperties()); set { {_property = value;} } } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Target = value ?? null; } + + /// Internal Acessors for ValidationStatus + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal.ValidationStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)Property).ValidationStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)Property).ValidationStatus = value ?? null; } + + /// Internal Acessors for ValidationType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutputInternal.ValidationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).ValidationType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).ValidationType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties _property; + + /// The address validation properties. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AddressValidationProperties()); } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).Target; } + + /// The address validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ValidationStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)Property).ValidationStatus; } + + /// Identifies the type of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ValidationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)Property).ValidationType; } + + /// Creates an new instance. + public AddressValidationOutput() + { + + } + } + /// Output of the address validation api. + public partial interface IAddressValidationOutput : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets additional error info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// List of alternate addresses. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of alternate addresses.", + SerializedName = @"alternateAddresses", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) })] + System.Collections.Generic.List AlternateAddress { get; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets details for the error.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) })] + System.Collections.Generic.List Detail { get; } + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message parsed from the body of the http error response.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the target of the error.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + /// The address validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The address validation status.", + SerializedName = @"validationStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Ambiguous")] + string ValidationStatus { get; } + /// Identifies the type of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Identifies the type of validation response.", + SerializedName = @"validationType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", "ValidateCreateOrderLimit", "ValidateSkuAvailability", "ValidateDataTransferDetails")] + string ValidationType { get; } + + } + /// Output of the address validation api. + internal partial interface IAddressValidationOutputInternal + + { + /// Gets or sets additional error info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// List of alternate addresses. + System.Collections.Generic.List AlternateAddress { get; set; } + /// Error code. + string Code { get; set; } + /// Gets or sets details for the error. + System.Collections.Generic.List Detail { get; set; } + /// Error code and message of validation response. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get; set; } + /// The error message parsed from the body of the http error response. + string Message { get; set; } + /// The address validation properties. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties Property { get; set; } + /// Gets or sets the target of the error. + string Target { get; set; } + /// The address validation status. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Ambiguous")] + string ValidationStatus { get; set; } + /// Identifies the type of validation response. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", "ValidateCreateOrderLimit", "ValidateSkuAvailability", "ValidateDataTransferDetails")] + string ValidationType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.json.cs new file mode 100644 index 00000000000..83c9c5f8684 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationOutput.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Output of the address validation api. + public partial class AddressValidationOutput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal AddressValidationOutput(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AddressValidationProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutput FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new AddressValidationOutput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.PowerShell.cs new file mode 100644 index 00000000000..cc1473e2b65 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.PowerShell.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The address validation output. + [System.ComponentModel.TypeConverter(typeof(AddressValidationPropertiesTypeConverter))] + public partial class AddressValidationProperties + { + + /// + /// 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 AddressValidationProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ValidationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)this).ValidationStatus = (string) content.GetValueForProperty("ValidationStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)this).ValidationStatus, global::System.Convert.ToString); + } + if (content.Contains("AlternateAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)this).AlternateAddress = (System.Collections.Generic.List) content.GetValueForProperty("AlternateAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)this).AlternateAddress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, 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 AddressValidationProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ValidationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)this).ValidationStatus = (string) content.GetValueForProperty("ValidationStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)this).ValidationStatus, global::System.Convert.ToString); + } + if (content.Contains("AlternateAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)this).AlternateAddress = (System.Collections.Generic.List) content.GetValueForProperty("AlternateAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal)this).AlternateAddress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, 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.DataBox.Models.IAddressValidationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AddressValidationProperties(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.DataBox.Models.IAddressValidationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AddressValidationProperties(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.DataBox.Models.IAddressValidationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 address validation output. + [System.ComponentModel.TypeConverter(typeof(AddressValidationPropertiesTypeConverter))] + public partial interface IAddressValidationProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.TypeConverter.cs new file mode 100644 index 00000000000..fb2c5076be8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AddressValidationPropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AddressValidationProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AddressValidationProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AddressValidationProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.cs new file mode 100644 index 00000000000..21fac18a697 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The address validation output. + public partial class AddressValidationProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse __validationInputResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse(); + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo; } + + /// Backing field for property. + private System.Collections.Generic.List _alternateAddress; + + /// List of alternate addresses. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List AlternateAddress { get => this._alternateAddress; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail; } + + /// Error code and message of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error = value ?? null /* model class */; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message; } + + /// Internal Acessors for AlternateAddress + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal.AlternateAddress { get => this._alternateAddress; set { {_alternateAddress = value;} } } + + /// Internal Acessors for ValidationStatus + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationPropertiesInternal.ValidationStatus { get => this._validationStatus; set { {_validationStatus = value;} } } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error = value ?? null /* model class */; } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target = value ?? null; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target; } + + /// Backing field for property. + private string _validationStatus; + + /// The address validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ValidationStatus { get => this._validationStatus; } + + /// Identifies the type of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationType { get => "ValidateAddress"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).ValidationType = "ValidateAddress"; } + + /// Creates an new instance. + public AddressValidationProperties() + { + this.__validationInputResponse.ValidationType = "ValidateAddress"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationInputResponse), __validationInputResponse); + await eventListener.AssertObjectIsValid(nameof(__validationInputResponse), __validationInputResponse); + } + } + /// The address validation output. + public partial interface IAddressValidationProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse + { + /// List of alternate addresses. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of alternate addresses.", + SerializedName = @"alternateAddresses", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) })] + System.Collections.Generic.List AlternateAddress { get; } + /// The address validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The address validation status.", + SerializedName = @"validationStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Ambiguous")] + string ValidationStatus { get; } + + } + /// The address validation output. + internal partial interface IAddressValidationPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal + { + /// List of alternate addresses. + System.Collections.Generic.List AlternateAddress { get; set; } + /// The address validation status. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Ambiguous")] + string ValidationStatus { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.json.cs new file mode 100644 index 00000000000..ab2ea57142d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AddressValidationProperties.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The address validation output. + public partial class AddressValidationProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal AddressValidationProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationInputResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse(json); + {_validationStatus = If( json?.PropertyT("validationStatus"), out var __jsonValidationStatus) ? (string)__jsonValidationStatus : (string)_validationStatus;} + {_alternateAddress = If( json?.PropertyT("alternateAddresses"), out var __jsonAlternateAddresses) ? If( __jsonAlternateAddresses as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IShippingAddress) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress.FromJson(__u) )) ))() : null : _alternateAddress;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new AddressValidationProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationInputResponse?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._validationStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._validationStatus.ToString()) : null, "validationStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._alternateAddress) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._alternateAddress ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("alternateAddresses",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.PowerShell.cs new file mode 100644 index 00000000000..a7bfd7f5b00 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Anything + [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] + public partial class Any + { + + /// + /// 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 Any(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Any(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + 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.DataBox.Models.IAny DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Any(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.DataBox.Models.IAny DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Any(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.DataBox.Models.IAny FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Anything + [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] + public partial interface IAny + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.TypeConverter.cs new file mode 100644 index 00000000000..d912b71dda9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AnyTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Any.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Any.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Any.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.cs new file mode 100644 index 00000000000..29c2b2abfb7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Anything + public partial class Any : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAnyInternal + { + + /// Creates an new instance. + public Any() + { + + } + } + /// Anything + public partial interface IAny : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + + } + /// Anything + internal partial interface IAnyInternal + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.json.cs new file mode 100644 index 00000000000..f26eadbbf73 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Any.json.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Anything + public partial class Any + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal Any(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new Any(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.PowerShell.cs new file mode 100644 index 00000000000..500564fab60 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.PowerShell.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ApiErrorTypeConverter))] + public partial class ApiError + { + + /// + /// 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 ApiError(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Target, 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 ApiError(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal)this).Target, 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.DataBox.Models.IApiError DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApiError(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.DataBox.Models.IApiError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApiError(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.DataBox.Models.IApiError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(ApiErrorTypeConverter))] + public partial interface IApiError + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.TypeConverter.cs new file mode 100644 index 00000000000..291fe6b806a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApiErrorTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiError ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiError).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApiError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApiError.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApiError.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.cs new file mode 100644 index 00000000000..fe2f6b7dcd7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class ApiError : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiError, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal + { + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)Error).Code = value ; } + + /// Error target. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)Error).Detail = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail _error; + + /// The error detail. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ErrorDetail()); set => this._error = value; } + + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)Error).Message = value ; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiErrorInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ErrorDetail()); set { {_error = value;} } } + + /// Additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)Error).Target = value ?? null; } + + /// Creates an new instance. + public ApiError() + { + + } + } + public partial interface IApiError : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// Error target. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Error target.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetails) })] + System.Collections.Generic.List Detail { get; set; } + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// Additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Additional error info.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; set; } + + } + internal partial interface IApiErrorInternal + + { + /// Error code. + string Code { get; set; } + /// Error target. + System.Collections.Generic.List Detail { get; set; } + /// The error detail. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail Error { get; set; } + /// Error message. + string Message { get; set; } + /// Additional error info. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.json.cs new file mode 100644 index 00000000000..7338fd77de6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApiError.json.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class ApiError + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ApiError(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ErrorDetail.FromJson(__jsonError) : _error;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiError. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiError. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApiError FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ApiError(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.PowerShell.cs new file mode 100644 index 00000000000..1f344607cab --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The Network Adapter configuration of a DataBox. + [System.ComponentModel.TypeConverter(typeof(ApplianceNetworkConfigurationTypeConverter))] + public partial class ApplianceNetworkConfiguration + { + + /// + /// 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 ApplianceNetworkConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfigurationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfigurationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("MacAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfigurationInternal)this).MacAddress = (string) content.GetValueForProperty("MacAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfigurationInternal)this).MacAddress, 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 ApplianceNetworkConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfigurationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfigurationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("MacAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfigurationInternal)this).MacAddress = (string) content.GetValueForProperty("MacAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfigurationInternal)this).MacAddress, 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.DataBox.Models.IApplianceNetworkConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApplianceNetworkConfiguration(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.DataBox.Models.IApplianceNetworkConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApplianceNetworkConfiguration(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.DataBox.Models.IApplianceNetworkConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 Adapter configuration of a DataBox. + [System.ComponentModel.TypeConverter(typeof(ApplianceNetworkConfigurationTypeConverter))] + public partial interface IApplianceNetworkConfiguration + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.TypeConverter.cs new file mode 100644 index 00000000000..8a1b46e9c43 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApplianceNetworkConfigurationTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApplianceNetworkConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApplianceNetworkConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApplianceNetworkConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.cs new file mode 100644 index 00000000000..f5e20b30677 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The Network Adapter configuration of a DataBox. + public partial class ApplianceNetworkConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfigurationInternal + { + + /// Backing field for property. + private string _macAddress; + + /// Mac Address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string MacAddress { get => this._macAddress; } + + /// Internal Acessors for MacAddress + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfigurationInternal.MacAddress { get => this._macAddress; set { {_macAddress = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfigurationInternal.Name { get => this._name; set { {_name = value;} } } + + /// Backing field for property. + private string _name; + + /// Name of the network. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Creates an new instance. + public ApplianceNetworkConfiguration() + { + + } + } + /// The Network Adapter configuration of a DataBox. + public partial interface IApplianceNetworkConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Mac Address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Mac Address.", + SerializedName = @"macAddress", + PossibleTypes = new [] { typeof(string) })] + string MacAddress { get; } + /// Name of the network. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the network.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + + } + /// The Network Adapter configuration of a DataBox. + internal partial interface IApplianceNetworkConfigurationInternal + + { + /// Mac Address. + string MacAddress { get; set; } + /// Name of the network. + string Name { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.json.cs new file mode 100644 index 00000000000..02d20b7d69f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ApplianceNetworkConfiguration.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The Network Adapter configuration of a DataBox. + public partial class ApplianceNetworkConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ApplianceNetworkConfiguration(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_macAddress = If( json?.PropertyT("macAddress"), out var __jsonMacAddress) ? (string)__jsonMacAddress : (string)_macAddress;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ApplianceNetworkConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._macAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._macAddress.ToString()) : null, "macAddress" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.PowerShell.cs new file mode 100644 index 00000000000..71bf5547048 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The filters for showing the available skus. + [System.ComponentModel.TypeConverter(typeof(AvailableSkuRequestTypeConverter))] + public partial class AvailableSkuRequest + { + + /// + /// 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 AvailableSkuRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).SkuName = (System.Collections.Generic.List) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).SkuName, __y => TypeConverterExtensions.SelectToList(__y, 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 AvailableSkuRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).SkuName = (System.Collections.Generic.List) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal)this).SkuName, __y => TypeConverterExtensions.SelectToList(__y, 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.DataBox.Models.IAvailableSkuRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AvailableSkuRequest(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.DataBox.Models.IAvailableSkuRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AvailableSkuRequest(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.DataBox.Models.IAvailableSkuRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 filters for showing the available skus. + [System.ComponentModel.TypeConverter(typeof(AvailableSkuRequestTypeConverter))] + public partial interface IAvailableSkuRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.TypeConverter.cs new file mode 100644 index 00000000000..3ba8a5b9cb1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AvailableSkuRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AvailableSkuRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AvailableSkuRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AvailableSkuRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.cs new file mode 100644 index 00000000000..e0f8479a23a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The filters for showing the available skus. + public partial class AvailableSkuRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequestInternal + { + + /// Backing field for property. + private string _country; + + /// + /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Country { get => this._country; set => this._country = value; } + + /// Backing field for property. + private string _location; + + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Backing field for property. + private System.Collections.Generic.List _skuName; + + /// Sku Names to filter for available skus + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List SkuName { get => this._skuName; set => this._skuName = value; } + + /// Backing field for property. + private string _transferType; + + /// Type of the transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string TransferType { get => this._transferType; set => this._transferType = value; } + + /// Creates an new instance. + public AvailableSkuRequest() + { + + } + } + /// The filters for showing the available skus. + public partial interface IAvailableSkuRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// + /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string Country { get; set; } + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Sku Names to filter for available skus + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Sku Names to filter for available skus", + SerializedName = @"skuNames", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + System.Collections.Generic.List SkuName { get; set; } + /// Type of the transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the transfer.", + SerializedName = @"transferType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; set; } + + } + /// The filters for showing the available skus. + internal partial interface IAvailableSkuRequestInternal + + { + /// + /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + /// + string Country { get; set; } + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + string Location { get; set; } + /// Sku Names to filter for available skus + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + System.Collections.Generic.List SkuName { get; set; } + /// Type of the transfer. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.json.cs new file mode 100644 index 00000000000..9474fb7c18a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkuRequest.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The filters for showing the available skus. + public partial class AvailableSkuRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal AvailableSkuRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_transferType = If( json?.PropertyT("transferType"), out var __jsonTransferType) ? (string)__jsonTransferType : (string)_transferType;} + {_country = If( json?.PropertyT("country"), out var __jsonCountry) ? (string)__jsonCountry : (string)_country;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)_location;} + {_skuName = If( json?.PropertyT("skuNames"), out var __jsonSkuNames) ? If( __jsonSkuNames as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _skuName;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new AvailableSkuRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._transferType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._transferType.ToString()) : null, "transferType" ,container.Add ); + AddIf( null != (((object)this._country)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._country.ToString()) : null, "country" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + if (null != this._skuName) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._skuName ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("skuNames",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.PowerShell.cs new file mode 100644 index 00000000000..836225b43aa --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The available skus operation response. + [System.ComponentModel.TypeConverter(typeof(AvailableSkusResultTypeConverter))] + public partial class AvailableSkusResult + { + + /// + /// 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 AvailableSkusResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuInformationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResultInternal)this).NextLink, 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 AvailableSkusResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuInformationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResultInternal)this).NextLink, 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.DataBox.Models.IAvailableSkusResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AvailableSkusResult(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.DataBox.Models.IAvailableSkusResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AvailableSkusResult(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.DataBox.Models.IAvailableSkusResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 available skus operation response. + [System.ComponentModel.TypeConverter(typeof(AvailableSkusResultTypeConverter))] + public partial interface IAvailableSkusResult + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.TypeConverter.cs new file mode 100644 index 00000000000..807292322f3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AvailableSkusResultTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AvailableSkusResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AvailableSkusResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AvailableSkusResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.cs new file mode 100644 index 00000000000..8de5ee395a4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The available skus operation response. + public partial class AvailableSkusResult : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResult, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResultInternal + { + + /// Internal Acessors for Value + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResultInternal.Value { get => this._value; set { {_value = value;} } } + + /// Backing field for property. + private string _nextLink; + + /// [Placeholder] Description for nextLink property + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// [Placeholder] Description for page model + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; } + + /// Creates an new instance. + public AvailableSkusResult() + { + + } + } + /// The available skus operation response. + public partial interface IAvailableSkusResult : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// [Placeholder] Description for nextLink property + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"[Placeholder] Description for nextLink property", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// [Placeholder] Description for page model + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"[Placeholder] Description for page model", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformation) })] + System.Collections.Generic.List Value { get; } + + } + /// The available skus operation response. + internal partial interface IAvailableSkusResultInternal + + { + /// [Placeholder] Description for nextLink property + string NextLink { get; set; } + /// [Placeholder] Description for page model + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.json.cs new file mode 100644 index 00000000000..58043e5eded --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AvailableSkusResult.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The available skus operation response. + public partial class AvailableSkusResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal AvailableSkusResult(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.ISkuInformation) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuInformation.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.DataBox.Models.IAvailableSkusResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkusResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new AvailableSkusResult(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.PowerShell.cs new file mode 100644 index 00000000000..49c33a48898 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Filter details to transfer Azure files + [System.ComponentModel.TypeConverter(typeof(AzureFileFilterDetailsTypeConverter))] + public partial class AzureFileFilterDetails + { + + /// + /// 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 AzureFileFilterDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FilePrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)this).FilePrefixList = (System.Collections.Generic.List) content.GetValueForProperty("FilePrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)this).FilePrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("FilePathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)this).FilePathList = (System.Collections.Generic.List) content.GetValueForProperty("FilePathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)this).FilePathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("FileShareList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)this).FileShareList = (System.Collections.Generic.List) content.GetValueForProperty("FileShareList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)this).FileShareList, __y => TypeConverterExtensions.SelectToList(__y, 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 AzureFileFilterDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FilePrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)this).FilePrefixList = (System.Collections.Generic.List) content.GetValueForProperty("FilePrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)this).FilePrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("FilePathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)this).FilePathList = (System.Collections.Generic.List) content.GetValueForProperty("FilePathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)this).FilePathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("FileShareList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)this).FileShareList = (System.Collections.Generic.List) content.GetValueForProperty("FileShareList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)this).FileShareList, __y => TypeConverterExtensions.SelectToList(__y, 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.DataBox.Models.IAzureFileFilterDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureFileFilterDetails(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.DataBox.Models.IAzureFileFilterDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureFileFilterDetails(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.DataBox.Models.IAzureFileFilterDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Filter details to transfer Azure files + [System.ComponentModel.TypeConverter(typeof(AzureFileFilterDetailsTypeConverter))] + public partial interface IAzureFileFilterDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.TypeConverter.cs new file mode 100644 index 00000000000..b018ca0bea5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureFileFilterDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureFileFilterDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureFileFilterDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureFileFilterDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.cs new file mode 100644 index 00000000000..77688b74b6f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Filter details to transfer Azure files + public partial class AzureFileFilterDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _filePathList; + + /// List of full path of the files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List FilePathList { get => this._filePathList; set => this._filePathList = value; } + + /// Backing field for property. + private System.Collections.Generic.List _filePrefixList; + + /// Prefix list of the Azure files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List FilePrefixList { get => this._filePrefixList; set => this._filePrefixList = value; } + + /// Backing field for property. + private System.Collections.Generic.List _fileShareList; + + /// List of file shares to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List FileShareList { get => this._fileShareList; set => this._fileShareList = value; } + + /// Creates an new instance. + public AzureFileFilterDetails() + { + + } + } + /// Filter details to transfer Azure files + public partial interface IAzureFileFilterDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// List of full path of the files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of full path of the files to be transferred.", + SerializedName = @"filePathList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List FilePathList { get; set; } + /// Prefix list of the Azure files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Prefix list of the Azure files to be transferred.", + SerializedName = @"filePrefixList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List FilePrefixList { get; set; } + /// List of file shares to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of file shares to be transferred.", + SerializedName = @"fileShareList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List FileShareList { get; set; } + + } + /// Filter details to transfer Azure files + internal partial interface IAzureFileFilterDetailsInternal + + { + /// List of full path of the files to be transferred. + System.Collections.Generic.List FilePathList { get; set; } + /// Prefix list of the Azure files to be transferred. + System.Collections.Generic.List FilePrefixList { get; set; } + /// List of file shares to be transferred. + System.Collections.Generic.List FileShareList { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.json.cs new file mode 100644 index 00000000000..7d5a27f050a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/AzureFileFilterDetails.json.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Filter details to transfer Azure files + public partial class AzureFileFilterDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal AzureFileFilterDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_filePrefixList = If( json?.PropertyT("filePrefixList"), out var __jsonFilePrefixList) ? If( __jsonFilePrefixList as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _filePrefixList;} + {_filePathList = If( json?.PropertyT("filePathList"), out var __jsonFilePathList) ? If( __jsonFilePathList as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : _filePathList;} + {_fileShareList = If( json?.PropertyT("fileShareList"), out var __jsonFileShareList) ? If( __jsonFileShareList as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __l) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__l, (__k)=>(string) (__k is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString __j ? (string)(__j.ToString()) : null)) ))() : null : _fileShareList;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new AzureFileFilterDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._filePrefixList) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._filePrefixList ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("filePrefixList",__w); + } + if (null != this._filePathList) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __s in this._filePathList ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("filePathList",__r); + } + if (null != this._fileShareList) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __n in this._fileShareList ) + { + AddIf(null != (((object)__n)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__n.ToString()) : null ,__m.Add); + } + container.Add("fileShareList",__m); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.PowerShell.cs new file mode 100644 index 00000000000..56a54dcd3c8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Filter details to transfer Azure Blobs + [System.ComponentModel.TypeConverter(typeof(BlobFilterDetailsTypeConverter))] + public partial class BlobFilterDetails + { + + /// + /// 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 BlobFilterDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BlobPrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)this).BlobPrefixList = (System.Collections.Generic.List) content.GetValueForProperty("BlobPrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)this).BlobPrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobPathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)this).BlobPathList = (System.Collections.Generic.List) content.GetValueForProperty("BlobPathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)this).BlobPathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContainerList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)this).ContainerList = (System.Collections.Generic.List) content.GetValueForProperty("ContainerList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)this).ContainerList, __y => TypeConverterExtensions.SelectToList(__y, 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 BlobFilterDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BlobPrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)this).BlobPrefixList = (System.Collections.Generic.List) content.GetValueForProperty("BlobPrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)this).BlobPrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobPathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)this).BlobPathList = (System.Collections.Generic.List) content.GetValueForProperty("BlobPathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)this).BlobPathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContainerList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)this).ContainerList = (System.Collections.Generic.List) content.GetValueForProperty("ContainerList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)this).ContainerList, __y => TypeConverterExtensions.SelectToList(__y, 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.DataBox.Models.IBlobFilterDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlobFilterDetails(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.DataBox.Models.IBlobFilterDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlobFilterDetails(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.DataBox.Models.IBlobFilterDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Filter details to transfer Azure Blobs + [System.ComponentModel.TypeConverter(typeof(BlobFilterDetailsTypeConverter))] + public partial interface IBlobFilterDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.TypeConverter.cs new file mode 100644 index 00000000000..61c4ca3fa47 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlobFilterDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlobFilterDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlobFilterDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlobFilterDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.cs new file mode 100644 index 00000000000..f7a1d214a31 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Filter details to transfer Azure Blobs + public partial class BlobFilterDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _blobPathList; + + /// List of full path of the blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List BlobPathList { get => this._blobPathList; set => this._blobPathList = value; } + + /// Backing field for property. + private System.Collections.Generic.List _blobPrefixList; + + /// Prefix list of the Azure blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List BlobPrefixList { get => this._blobPrefixList; set => this._blobPrefixList = value; } + + /// Backing field for property. + private System.Collections.Generic.List _containerList; + + /// List of blob containers to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List ContainerList { get => this._containerList; set => this._containerList = value; } + + /// Creates an new instance. + public BlobFilterDetails() + { + + } + } + /// Filter details to transfer Azure Blobs + public partial interface IBlobFilterDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// List of full path of the blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of full path of the blobs to be transferred.", + SerializedName = @"blobPathList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobPathList { get; set; } + /// Prefix list of the Azure blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Prefix list of the Azure blobs to be transferred.", + SerializedName = @"blobPrefixList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobPrefixList { get; set; } + /// List of blob containers to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of blob containers to be transferred.", + SerializedName = @"containerList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List ContainerList { get; set; } + + } + /// Filter details to transfer Azure Blobs + internal partial interface IBlobFilterDetailsInternal + + { + /// List of full path of the blobs to be transferred. + System.Collections.Generic.List BlobPathList { get; set; } + /// Prefix list of the Azure blobs to be transferred. + System.Collections.Generic.List BlobPrefixList { get; set; } + /// List of blob containers to be transferred. + System.Collections.Generic.List ContainerList { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.json.cs new file mode 100644 index 00000000000..ffcd6fd6d85 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/BlobFilterDetails.json.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Filter details to transfer Azure Blobs + public partial class BlobFilterDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal BlobFilterDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_blobPrefixList = If( json?.PropertyT("blobPrefixList"), out var __jsonBlobPrefixList) ? If( __jsonBlobPrefixList as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _blobPrefixList;} + {_blobPathList = If( json?.PropertyT("blobPathList"), out var __jsonBlobPathList) ? If( __jsonBlobPathList as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : _blobPathList;} + {_containerList = If( json?.PropertyT("containerList"), out var __jsonContainerList) ? If( __jsonContainerList as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __l) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__l, (__k)=>(string) (__k is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString __j ? (string)(__j.ToString()) : null)) ))() : null : _containerList;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new BlobFilterDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._blobPrefixList) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._blobPrefixList ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("blobPrefixList",__w); + } + if (null != this._blobPathList) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __s in this._blobPathList ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("blobPathList",__r); + } + if (null != this._containerList) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __n in this._containerList ) + { + AddIf(null != (((object)__n)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__n.ToString()) : null ,__m.Add); + } + container.Add("containerList",__m); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.PowerShell.cs new file mode 100644 index 00000000000..a355455f110 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Reason for cancellation. + [System.ComponentModel.TypeConverter(typeof(CancellationReasonTypeConverter))] + public partial class CancellationReason + { + + /// + /// 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 CancellationReason(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Reason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReasonInternal)this).Reason = (string) content.GetValueForProperty("Reason",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReasonInternal)this).Reason, 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 CancellationReason(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Reason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReasonInternal)this).Reason = (string) content.GetValueForProperty("Reason",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReasonInternal)this).Reason, 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.DataBox.Models.ICancellationReason DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CancellationReason(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.DataBox.Models.ICancellationReason DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CancellationReason(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.DataBox.Models.ICancellationReason FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Reason for cancellation. + [System.ComponentModel.TypeConverter(typeof(CancellationReasonTypeConverter))] + public partial interface ICancellationReason + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.TypeConverter.cs new file mode 100644 index 00000000000..b8ba1ff6881 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CancellationReasonTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CancellationReason.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CancellationReason.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CancellationReason.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.cs new file mode 100644 index 00000000000..2317586696c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Reason for cancellation. + public partial class CancellationReason : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReasonInternal + { + + /// Backing field for property. + private string _reason; + + /// Reason for cancellation. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Reason { get => this._reason; set => this._reason = value; } + + /// Creates an new instance. + public CancellationReason() + { + + } + } + /// Reason for cancellation. + public partial interface ICancellationReason : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Reason for cancellation. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Reason for cancellation.", + SerializedName = @"reason", + PossibleTypes = new [] { typeof(string) })] + string Reason { get; set; } + + } + /// Reason for cancellation. + internal partial interface ICancellationReasonInternal + + { + /// Reason for cancellation. + string Reason { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.json.cs new file mode 100644 index 00000000000..71e5fae65fa --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CancellationReason.json.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Reason for cancellation. + public partial class CancellationReason + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal CancellationReason(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_reason = If( json?.PropertyT("reason"), out var __jsonReason) ? (string)__jsonReason : (string)_reason;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new CancellationReason(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._reason)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._reason.ToString()) : null, "reason" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.PowerShell.cs new file mode 100644 index 00000000000..9f773fa9938 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.PowerShell.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Provides additional information about an http error response. + [System.ComponentModel.TypeConverter(typeof(CloudErrorTypeConverter))] + public partial class CloudError + { + + /// + /// 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 CloudError(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Target, 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 CloudError(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)this).Target, 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.DataBox.Models.ICloudError DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CloudError(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.DataBox.Models.ICloudError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CloudError(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.DataBox.Models.ICloudError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Provides additional information about an http error response. + [System.ComponentModel.TypeConverter(typeof(CloudErrorTypeConverter))] + public partial interface ICloudError + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.TypeConverter.cs new file mode 100644 index 00000000000..8b5cb545291 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CloudErrorTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CloudError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CloudError.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CloudError.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.cs new file mode 100644 index 00000000000..b7710d601e0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Provides additional information about an http error response. + public partial class CloudError : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _additionalInfo; + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List AdditionalInfo { get => this._additionalInfo; } + + /// Backing field for property. + private string _code; + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Code { get => this._code; set => this._code = value; } + + /// Backing field for property. + private System.Collections.Generic.List _detail; + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List Detail { get => this._detail; } + + /// Backing field for property. + private string _message; + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal.Detail { get => this._detail; set { {_detail = value;} } } + + /// Backing field for property. + private string _target; + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Target { get => this._target; set => this._target = value; } + + /// Creates an new instance. + public CloudError() + { + + } + } + /// Provides additional information about an http error response. + public partial interface ICloudError : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets additional error info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets details for the error.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) })] + System.Collections.Generic.List Detail { get; } + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The error message parsed from the body of the http error response.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets the target of the error.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; set; } + + } + /// Provides additional information about an http error response. + internal partial interface ICloudErrorInternal + + { + /// Gets or sets additional error info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// Error code. + string Code { get; set; } + /// Gets or sets details for the error. + System.Collections.Generic.List Detail { get; set; } + /// The error message parsed from the body of the http error response. + string Message { get; set; } + /// Gets or sets the target of the error. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.json.cs new file mode 100644 index 00000000000..840c0867e72 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CloudError.json.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Provides additional information about an http error response. + public partial class CloudError + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal CloudError(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IAdditionalErrorInfo1) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1.FromJson(__u) )) ))() : null : _additionalInfo;} + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)_code;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.ICloudError) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError.FromJson(__p) )) ))() : null : _detail;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)_message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)_target;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new CloudError(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._additionalInfo) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._additionalInfo ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("additionalInfo",__w); + } + } + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._detail) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __s in this._detail ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("details",__r); + } + } + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.PowerShell.cs new file mode 100644 index 00000000000..be7b05bc071 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Contact Details. + [System.ComponentModel.TypeConverter(typeof(ContactDetailsTypeConverter))] + public partial class ContactDetails + { + + /// + /// 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 ContactDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).ContactName = (string) content.GetValueForProperty("ContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).ContactName, global::System.Convert.ToString); + } + if (content.Contains("Phone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).Phone, global::System.Convert.ToString); + } + if (content.Contains("PhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).PhoneExtension = (string) content.GetValueForProperty("PhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).PhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("Mobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).Mobile = (string) content.GetValueForProperty("Mobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).Mobile, global::System.Convert.ToString); + } + if (content.Contains("EmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).EmailList = (System.Collections.Generic.List) content.GetValueForProperty("EmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).EmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("NotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).NotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("NotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).NotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ContactDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).ContactName = (string) content.GetValueForProperty("ContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).ContactName, global::System.Convert.ToString); + } + if (content.Contains("Phone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).Phone, global::System.Convert.ToString); + } + if (content.Contains("PhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).PhoneExtension = (string) content.GetValueForProperty("PhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).PhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("Mobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).Mobile = (string) content.GetValueForProperty("Mobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).Mobile, global::System.Convert.ToString); + } + if (content.Contains("EmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).EmailList = (System.Collections.Generic.List) content.GetValueForProperty("EmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).EmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("NotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).NotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("NotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)this).NotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + 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.DataBox.Models.IContactDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ContactDetails(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.DataBox.Models.IContactDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ContactDetails(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.DataBox.Models.IContactDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Contact Details. + [System.ComponentModel.TypeConverter(typeof(ContactDetailsTypeConverter))] + public partial interface IContactDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.TypeConverter.cs new file mode 100644 index 00000000000..70e997aa046 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ContactDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ContactDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ContactDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ContactDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.cs new file mode 100644 index 00000000000..bf9549202eb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Contact Details. + public partial class ContactDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal + { + + /// Backing field for property. + private string _contactName; + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ContactName { get => this._contactName; set => this._contactName = value; } + + /// Backing field for property. + private System.Collections.Generic.List _emailList; + + /// List of Email-ids to be notified about job progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List EmailList { get => this._emailList; set => this._emailList = value; } + + /// Backing field for property. + private string _mobile; + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Mobile { get => this._mobile; set => this._mobile = value; } + + /// Backing field for property. + private System.Collections.Generic.List _notificationPreference; + + /// Notification preference for a job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List NotificationPreference { get => this._notificationPreference; set => this._notificationPreference = value; } + + /// Backing field for property. + private string _phone; + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Phone { get => this._phone; set => this._phone = value; } + + /// Backing field for property. + private string _phoneExtension; + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string PhoneExtension { get => this._phoneExtension; set => this._phoneExtension = value; } + + /// Creates an new instance. + public ContactDetails() + { + + } + } + /// Contact Details. + public partial interface IContactDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Contact name of the person.", + SerializedName = @"contactName", + PossibleTypes = new [] { typeof(string) })] + string ContactName { get; set; } + /// List of Email-ids to be notified about job progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of Email-ids to be notified about job progress.", + SerializedName = @"emailList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List EmailList { get; set; } + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Mobile number of the contact person.", + SerializedName = @"mobile", + PossibleTypes = new [] { typeof(string) })] + string Mobile { get; set; } + /// Notification preference for a job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Notification preference for a job stage.", + SerializedName = @"notificationPreference", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreference) })] + System.Collections.Generic.List NotificationPreference { get; set; } + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone number of the contact person.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string Phone { get; set; } + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone extension number of the contact person.", + SerializedName = @"phoneExtension", + PossibleTypes = new [] { typeof(string) })] + string PhoneExtension { get; set; } + + } + /// Contact Details. + internal partial interface IContactDetailsInternal + + { + /// Contact name of the person. + string ContactName { get; set; } + /// List of Email-ids to be notified about job progress. + System.Collections.Generic.List EmailList { get; set; } + /// Mobile number of the contact person. + string Mobile { get; set; } + /// Notification preference for a job stage. + System.Collections.Generic.List NotificationPreference { get; set; } + /// Phone number of the contact person. + string Phone { get; set; } + /// Phone extension number of the contact person. + string PhoneExtension { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.json.cs new file mode 100644 index 00000000000..1477b193262 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactDetails.json.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Contact Details. + public partial class ContactDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ContactDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_contactName = If( json?.PropertyT("contactName"), out var __jsonContactName) ? (string)__jsonContactName : (string)_contactName;} + {_phone = If( json?.PropertyT("phone"), out var __jsonPhone) ? (string)__jsonPhone : (string)_phone;} + {_phoneExtension = If( json?.PropertyT("phoneExtension"), out var __jsonPhoneExtension) ? (string)__jsonPhoneExtension : (string)_phoneExtension;} + {_mobile = If( json?.PropertyT("mobile"), out var __jsonMobile) ? (string)__jsonMobile : (string)_mobile;} + {_emailList = If( json?.PropertyT("emailList"), out var __jsonEmailList) ? If( __jsonEmailList as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _emailList;} + {_notificationPreference = If( json?.PropertyT("notificationPreference"), out var __jsonNotificationPreference) ? If( __jsonNotificationPreference as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.INotificationPreference) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreference.FromJson(__p) )) ))() : null : _notificationPreference;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ContactDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._contactName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._contactName.ToString()) : null, "contactName" ,container.Add ); + AddIf( null != (((object)this._phone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._phone.ToString()) : null, "phone" ,container.Add ); + AddIf( null != (((object)this._phoneExtension)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._phoneExtension.ToString()) : null, "phoneExtension" ,container.Add ); + AddIf( null != (((object)this._mobile)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._mobile.ToString()) : null, "mobile" ,container.Add ); + if (null != this._emailList) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._emailList ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("emailList",__w); + } + if (null != this._notificationPreference) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __s in this._notificationPreference ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("notificationPreference",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.PowerShell.cs new file mode 100644 index 00000000000..b4a8b656c87 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Contact Info. + [System.ComponentModel.TypeConverter(typeof(ContactInfoTypeConverter))] + public partial class ContactInfo + { + + /// + /// 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 ContactInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).ContactName = (string) content.GetValueForProperty("ContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).ContactName, global::System.Convert.ToString); + } + if (content.Contains("Phone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).Phone, global::System.Convert.ToString); + } + if (content.Contains("PhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).PhoneExtension = (string) content.GetValueForProperty("PhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).PhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("Mobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).Mobile = (string) content.GetValueForProperty("Mobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).Mobile, 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 ContactInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).ContactName = (string) content.GetValueForProperty("ContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).ContactName, global::System.Convert.ToString); + } + if (content.Contains("Phone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).Phone, global::System.Convert.ToString); + } + if (content.Contains("PhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).PhoneExtension = (string) content.GetValueForProperty("PhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).PhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("Mobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).Mobile = (string) content.GetValueForProperty("Mobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)this).Mobile, 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.DataBox.Models.IContactInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ContactInfo(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.DataBox.Models.IContactInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ContactInfo(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.DataBox.Models.IContactInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Contact Info. + [System.ComponentModel.TypeConverter(typeof(ContactInfoTypeConverter))] + public partial interface IContactInfo + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.TypeConverter.cs new file mode 100644 index 00000000000..6054be5cd66 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ContactInfoTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ContactInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ContactInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ContactInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.cs new file mode 100644 index 00000000000..64d158f4f28 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Contact Info. + public partial class ContactInfo : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal + { + + /// Backing field for property. + private string _contactName; + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ContactName { get => this._contactName; set => this._contactName = value; } + + /// Backing field for property. + private string _mobile; + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Mobile { get => this._mobile; set => this._mobile = value; } + + /// Backing field for property. + private string _phone; + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Phone { get => this._phone; set => this._phone = value; } + + /// Backing field for property. + private string _phoneExtension; + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string PhoneExtension { get => this._phoneExtension; set => this._phoneExtension = value; } + + /// Creates an new instance. + public ContactInfo() + { + + } + } + /// Contact Info. + public partial interface IContactInfo : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Contact name of the person.", + SerializedName = @"contactName", + PossibleTypes = new [] { typeof(string) })] + string ContactName { get; set; } + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Mobile number of the contact person.", + SerializedName = @"mobile", + PossibleTypes = new [] { typeof(string) })] + string Mobile { get; set; } + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone number of the contact person.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string Phone { get; set; } + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone extension number of the contact person.", + SerializedName = @"phoneExtension", + PossibleTypes = new [] { typeof(string) })] + string PhoneExtension { get; set; } + + } + /// Contact Info. + internal partial interface IContactInfoInternal + + { + /// Contact name of the person. + string ContactName { get; set; } + /// Mobile number of the contact person. + string Mobile { get; set; } + /// Phone number of the contact person. + string Phone { get; set; } + /// Phone extension number of the contact person. + string PhoneExtension { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.json.cs new file mode 100644 index 00000000000..a6fe87b4b58 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ContactInfo.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Contact Info. + public partial class ContactInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ContactInfo(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_contactName = If( json?.PropertyT("contactName"), out var __jsonContactName) ? (string)__jsonContactName : (string)_contactName;} + {_phone = If( json?.PropertyT("phone"), out var __jsonPhone) ? (string)__jsonPhone : (string)_phone;} + {_phoneExtension = If( json?.PropertyT("phoneExtension"), out var __jsonPhoneExtension) ? (string)__jsonPhoneExtension : (string)_phoneExtension;} + {_mobile = If( json?.PropertyT("mobile"), out var __jsonMobile) ? (string)__jsonMobile : (string)_mobile;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ContactInfo(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._contactName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._contactName.ToString()) : null, "contactName" ,container.Add ); + AddIf( null != (((object)this._phone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._phone.ToString()) : null, "phone" ,container.Add ); + AddIf( null != (((object)this._phoneExtension)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._phoneExtension.ToString()) : null, "phoneExtension" ,container.Add ); + AddIf( null != (((object)this._mobile)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._mobile.ToString()) : null, "mobile" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.PowerShell.cs new file mode 100644 index 00000000000..0191242ee1f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Details for log generated during copy. + [System.ComponentModel.TypeConverter(typeof(CopyLogDetailsTypeConverter))] + public partial class CopyLogDetails + { + + /// + /// 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 CopyLogDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type, 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 CopyLogDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type, 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.DataBox.Models.ICopyLogDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CopyLogDetails(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.DataBox.Models.ICopyLogDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CopyLogDetails(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.DataBox.Models.ICopyLogDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Details for log generated during copy. + [System.ComponentModel.TypeConverter(typeof(CopyLogDetailsTypeConverter))] + public partial interface ICopyLogDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.TypeConverter.cs new file mode 100644 index 00000000000..ec93db8a203 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CopyLogDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CopyLogDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CopyLogDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CopyLogDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.cs new file mode 100644 index 00000000000..2ad3b51475d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details for log generated during copy. + public partial class CopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal + { + + /// Backing field for property. + private string _type; + + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public CopyLogDetails() + { + + } + } + /// Details for log generated during copy. + public partial interface ICopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates the type of job details.", + SerializedName = @"copyLogDetailsType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string Type { get; set; } + + } + /// Details for log generated during copy. + internal partial interface ICopyLogDetailsInternal + + { + /// Indicates the type of job details. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.json.cs new file mode 100644 index 00000000000..bcc514809d3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyLogDetails.json.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details for log generated during copy. + public partial class CopyLogDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal CopyLogDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("copyLogDetailsType"), out var __jsonCopyLogDetailsType) ? (string)__jsonCopyLogDetailsType : (string)_type;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails interface is polymorphic, and the precise + /// model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("copyLogDetailsType") ) + { + case "DataBox": + { + return new DataBoxAccountCopyLogDetails(json); + } + case "DataBoxCustomerDisk": + { + return new DataBoxCustomerDiskCopyLogDetails(json); + } + case "DataBoxDisk": + { + return new DataBoxDiskCopyLogDetails(json); + } + case "DataBoxHeavy": + { + return new DataBoxHeavyAccountCopyLogDetails(json); + } + } + return new CopyLogDetails(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._type.ToString()) : null, "copyLogDetailsType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.PowerShell.cs new file mode 100644 index 00000000000..4ecffb507e9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.PowerShell.cs @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Copy progress. + [System.ComponentModel.TypeConverter(typeof(CopyProgressTypeConverter))] + public partial class CopyProgress + { + + /// + /// 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 CopyProgress(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("StorageAccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).StorageAccountName = (string) content.GetValueForProperty("StorageAccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).StorageAccountName, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AccountId = (string) content.GetValueForProperty("AccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AccountId, global::System.Convert.ToString); + } + if (content.Contains("BytesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).BytesProcessed = (long?) content.GetValueForProperty("BytesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).BytesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBytesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalBytesToProcess = (long?) content.GetValueForProperty("TotalBytesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalBytesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesProcessed = (long?) content.GetValueForProperty("FilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalFilesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalFilesToProcess = (long?) content.GetValueForProperty("TotalFilesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalFilesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFilesProcessed = (long?) content.GetValueForProperty("InvalidFilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFileBytesUploaded")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFileBytesUploaded = (long?) content.GetValueForProperty("InvalidFileBytesUploaded",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFileBytesUploaded, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RenamedContainerCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).RenamedContainerCount = (long?) content.GetValueForProperty("RenamedContainerCount",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).RenamedContainerCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesErroredOut = (long?) content.GetValueForProperty("FilesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DirectoriesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DirectoriesErroredOut = (long?) content.GetValueForProperty("DirectoriesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DirectoriesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidDirectoriesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidDirectoriesProcessed = (long?) content.GetValueForProperty("InvalidDirectoriesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidDirectoriesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IsEnumerationInProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).IsEnumerationInProgress = (bool?) content.GetValueForProperty("IsEnumerationInProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).IsEnumerationInProgress, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Target, 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 CopyProgress(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("StorageAccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).StorageAccountName = (string) content.GetValueForProperty("StorageAccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).StorageAccountName, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AccountId = (string) content.GetValueForProperty("AccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AccountId, global::System.Convert.ToString); + } + if (content.Contains("BytesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).BytesProcessed = (long?) content.GetValueForProperty("BytesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).BytesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBytesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalBytesToProcess = (long?) content.GetValueForProperty("TotalBytesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalBytesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesProcessed = (long?) content.GetValueForProperty("FilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalFilesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalFilesToProcess = (long?) content.GetValueForProperty("TotalFilesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalFilesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFilesProcessed = (long?) content.GetValueForProperty("InvalidFilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFileBytesUploaded")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFileBytesUploaded = (long?) content.GetValueForProperty("InvalidFileBytesUploaded",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFileBytesUploaded, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RenamedContainerCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).RenamedContainerCount = (long?) content.GetValueForProperty("RenamedContainerCount",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).RenamedContainerCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesErroredOut = (long?) content.GetValueForProperty("FilesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DirectoriesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DirectoriesErroredOut = (long?) content.GetValueForProperty("DirectoriesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DirectoriesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidDirectoriesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidDirectoriesProcessed = (long?) content.GetValueForProperty("InvalidDirectoriesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidDirectoriesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IsEnumerationInProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).IsEnumerationInProgress = (bool?) content.GetValueForProperty("IsEnumerationInProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).IsEnumerationInProgress, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Target, 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.DataBox.Models.ICopyProgress DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CopyProgress(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.DataBox.Models.ICopyProgress DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CopyProgress(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.DataBox.Models.ICopyProgress FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Copy progress. + [System.ComponentModel.TypeConverter(typeof(CopyProgressTypeConverter))] + public partial interface ICopyProgress + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.TypeConverter.cs new file mode 100644 index 00000000000..2966f0c4392 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CopyProgressTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgress ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgress).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CopyProgress.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CopyProgress.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CopyProgress.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.cs new file mode 100644 index 00000000000..a651c81ad1b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.cs @@ -0,0 +1,552 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Copy progress. + public partial class CopyProgress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgress, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal + { + + /// Backing field for property. + private string _accountId; + + /// Id of the account where the data needs to be uploaded. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string AccountId { get => this._accountId; } + + /// Backing field for property. + private System.Collections.Generic.List _action; + + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List Action { get => this._action; } + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo; } + + /// Backing field for property. + private long? _bytesProcessed; + + /// To indicate bytes transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? BytesProcessed { get => this._bytesProcessed; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code; } + + /// Backing field for property. + private string _dataAccountType; + + /// Data Account Type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DataAccountType { get => this._dataAccountType; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail; } + + /// Backing field for property. + private long? _directoriesErroredOut; + + /// To indicate directories errored out in the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? DirectoriesErroredOut { get => this._directoriesErroredOut; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError _error; + + /// Error, if any, in the stage + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError()); } + + /// Backing field for property. + private long? _filesErroredOut; + + /// Number of files which could not be copied + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? FilesErroredOut { get => this._filesErroredOut; } + + /// Backing field for property. + private long? _filesProcessed; + + /// Number of files processed + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? FilesProcessed { get => this._filesProcessed; } + + /// Backing field for property. + private long? _invalidDirectoriesProcessed; + + /// To indicate directories renamed + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? InvalidDirectoriesProcessed { get => this._invalidDirectoriesProcessed; } + + /// Backing field for property. + private long? _invalidFileBytesUploaded; + + /// + /// Total amount of data not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? InvalidFileBytesUploaded { get => this._invalidFileBytesUploaded; } + + /// Backing field for property. + private long? _invalidFilesProcessed; + + /// + /// Number of files not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? InvalidFilesProcessed { get => this._invalidFilesProcessed; } + + /// Backing field for property. + private bool? _isEnumerationInProgress; + + /// + /// To indicate if enumeration of data is in progress. + /// Until this is true, the TotalBytesToProcess may not be valid. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? IsEnumerationInProgress { get => this._isEnumerationInProgress; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message; } + + /// Internal Acessors for AccountId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.AccountId { get => this._accountId; set { {_accountId = value;} } } + + /// Internal Acessors for Action + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.Action { get => this._action; set { {_action = value;} } } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for BytesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.BytesProcessed { get => this._bytesProcessed; set { {_bytesProcessed = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code = value ?? null; } + + /// Internal Acessors for DataAccountType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.DataAccountType { get => this._dataAccountType; set { {_dataAccountType = value;} } } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for DirectoriesErroredOut + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.DirectoriesErroredOut { get => this._directoriesErroredOut; set { {_directoriesErroredOut = value;} } } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError()); set { {_error = value;} } } + + /// Internal Acessors for FilesErroredOut + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.FilesErroredOut { get => this._filesErroredOut; set { {_filesErroredOut = value;} } } + + /// Internal Acessors for FilesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.FilesProcessed { get => this._filesProcessed; set { {_filesProcessed = value;} } } + + /// Internal Acessors for InvalidDirectoriesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.InvalidDirectoriesProcessed { get => this._invalidDirectoriesProcessed; set { {_invalidDirectoriesProcessed = value;} } } + + /// Internal Acessors for InvalidFileBytesUploaded + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.InvalidFileBytesUploaded { get => this._invalidFileBytesUploaded; set { {_invalidFileBytesUploaded = value;} } } + + /// Internal Acessors for InvalidFilesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.InvalidFilesProcessed { get => this._invalidFilesProcessed; set { {_invalidFilesProcessed = value;} } } + + /// Internal Acessors for IsEnumerationInProgress + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.IsEnumerationInProgress { get => this._isEnumerationInProgress; set { {_isEnumerationInProgress = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message = value ?? null; } + + /// Internal Acessors for RenamedContainerCount + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.RenamedContainerCount { get => this._renamedContainerCount; set { {_renamedContainerCount = value;} } } + + /// Internal Acessors for StorageAccountName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.StorageAccountName { get => this._storageAccountName; set { {_storageAccountName = value;} } } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target = value ?? null; } + + /// Internal Acessors for TotalBytesToProcess + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.TotalBytesToProcess { get => this._totalBytesToProcess; set { {_totalBytesToProcess = value;} } } + + /// Internal Acessors for TotalFilesToProcess + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.TotalFilesToProcess { get => this._totalFilesToProcess; set { {_totalFilesToProcess = value;} } } + + /// Internal Acessors for TransferType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.TransferType { get => this._transferType; set { {_transferType = value;} } } + + /// Backing field for property. + private long? _renamedContainerCount; + + /// + /// Number of folders not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? RenamedContainerCount { get => this._renamedContainerCount; } + + /// Backing field for property. + private string _storageAccountName; + + /// + /// Name of the storage account. This will be empty for data account types other than storage account. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StorageAccountName { get => this._storageAccountName; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target; } + + /// Backing field for property. + private long? _totalBytesToProcess; + + /// Total amount of data to be processed by the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? TotalBytesToProcess { get => this._totalBytesToProcess; } + + /// Backing field for property. + private long? _totalFilesToProcess; + + /// Total files to process + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? TotalFilesToProcess { get => this._totalFilesToProcess; } + + /// Backing field for property. + private string _transferType; + + /// Transfer type of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string TransferType { get => this._transferType; } + + /// Creates an new instance. + public CopyProgress() + { + + } + } + /// Copy progress. + public partial interface ICopyProgress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Id of the account where the data needs to be uploaded. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Id of the account where the data needs to be uploaded.", + SerializedName = @"accountId", + PossibleTypes = new [] { typeof(string) })] + string AccountId { get; } + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Available actions on the job.", + SerializedName = @"actions", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + System.Collections.Generic.List Action { get; } + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets additional error info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// To indicate bytes transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"To indicate bytes transferred.", + SerializedName = @"bytesProcessed", + PossibleTypes = new [] { typeof(long) })] + long? BytesProcessed { get; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// Data Account Type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Data Account Type.", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string DataAccountType { get; } + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets details for the error.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) })] + System.Collections.Generic.List Detail { get; } + /// To indicate directories errored out in the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"To indicate directories errored out in the job.", + SerializedName = @"directoriesErroredOut", + PossibleTypes = new [] { typeof(long) })] + long? DirectoriesErroredOut { get; } + /// Number of files which could not be copied + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of files which could not be copied", + SerializedName = @"filesErroredOut", + PossibleTypes = new [] { typeof(long) })] + long? FilesErroredOut { get; } + /// Number of files processed + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of files processed", + SerializedName = @"filesProcessed", + PossibleTypes = new [] { typeof(long) })] + long? FilesProcessed { get; } + /// To indicate directories renamed + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"To indicate directories renamed", + SerializedName = @"invalidDirectoriesProcessed", + PossibleTypes = new [] { typeof(long) })] + long? InvalidDirectoriesProcessed { get; } + /// + /// Total amount of data not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + SerializedName = @"invalidFileBytesUploaded", + PossibleTypes = new [] { typeof(long) })] + long? InvalidFileBytesUploaded { get; } + /// + /// Number of files not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of files not adhering to azure naming conventions which were processed by automatic renaming", + SerializedName = @"invalidFilesProcessed", + PossibleTypes = new [] { typeof(long) })] + long? InvalidFilesProcessed { get; } + /// + /// To indicate if enumeration of data is in progress. + /// Until this is true, the TotalBytesToProcess may not be valid. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid.", + SerializedName = @"isEnumerationInProgress", + PossibleTypes = new [] { typeof(bool) })] + bool? IsEnumerationInProgress { get; } + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message parsed from the body of the http error response.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// + /// Number of folders not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + SerializedName = @"renamedContainerCount", + PossibleTypes = new [] { typeof(long) })] + long? RenamedContainerCount { get; } + /// + /// Name of the storage account. This will be empty for data account types other than storage account. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the storage account. This will be empty for data account types other than storage account.", + SerializedName = @"storageAccountName", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountName { get; } + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the target of the error.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + /// Total amount of data to be processed by the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total amount of data to be processed by the job.", + SerializedName = @"totalBytesToProcess", + PossibleTypes = new [] { typeof(long) })] + long? TotalBytesToProcess { get; } + /// Total files to process + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total files to process", + SerializedName = @"totalFilesToProcess", + PossibleTypes = new [] { typeof(long) })] + long? TotalFilesToProcess { get; } + /// Transfer type of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Transfer type of data", + SerializedName = @"transferType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; } + + } + /// Copy progress. + internal partial interface ICopyProgressInternal + + { + /// Id of the account where the data needs to be uploaded. + string AccountId { get; set; } + /// Available actions on the job. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + System.Collections.Generic.List Action { get; set; } + /// Gets or sets additional error info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// To indicate bytes transferred. + long? BytesProcessed { get; set; } + /// Error code. + string Code { get; set; } + /// Data Account Type. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string DataAccountType { get; set; } + /// Gets or sets details for the error. + System.Collections.Generic.List Detail { get; set; } + /// To indicate directories errored out in the job. + long? DirectoriesErroredOut { get; set; } + /// Error, if any, in the stage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get; set; } + /// Number of files which could not be copied + long? FilesErroredOut { get; set; } + /// Number of files processed + long? FilesProcessed { get; set; } + /// To indicate directories renamed + long? InvalidDirectoriesProcessed { get; set; } + /// + /// Total amount of data not adhering to azure naming conventions which were processed by automatic renaming + /// + long? InvalidFileBytesUploaded { get; set; } + /// + /// Number of files not adhering to azure naming conventions which were processed by automatic renaming + /// + long? InvalidFilesProcessed { get; set; } + /// + /// To indicate if enumeration of data is in progress. + /// Until this is true, the TotalBytesToProcess may not be valid. + /// + bool? IsEnumerationInProgress { get; set; } + /// The error message parsed from the body of the http error response. + string Message { get; set; } + /// + /// Number of folders not adhering to azure naming conventions which were processed by automatic renaming + /// + long? RenamedContainerCount { get; set; } + /// + /// Name of the storage account. This will be empty for data account types other than storage account. + /// + string StorageAccountName { get; set; } + /// Gets or sets the target of the error. + string Target { get; set; } + /// Total amount of data to be processed by the job. + long? TotalBytesToProcess { get; set; } + /// Total files to process + long? TotalFilesToProcess { get; set; } + /// Transfer type of data + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.json.cs new file mode 100644 index 00000000000..c86f9cb1eba --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CopyProgress.json.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Copy progress. + public partial class CopyProgress + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal CopyProgress(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError.FromJson(__jsonError) : _error;} + {_storageAccountName = If( json?.PropertyT("storageAccountName"), out var __jsonStorageAccountName) ? (string)__jsonStorageAccountName : (string)_storageAccountName;} + {_transferType = If( json?.PropertyT("transferType"), out var __jsonTransferType) ? (string)__jsonTransferType : (string)_transferType;} + {_dataAccountType = If( json?.PropertyT("dataAccountType"), out var __jsonDataAccountType) ? (string)__jsonDataAccountType : (string)_dataAccountType;} + {_accountId = If( json?.PropertyT("accountId"), out var __jsonAccountId) ? (string)__jsonAccountId : (string)_accountId;} + {_bytesProcessed = If( json?.PropertyT("bytesProcessed"), out var __jsonBytesProcessed) ? (long?)__jsonBytesProcessed : _bytesProcessed;} + {_totalBytesToProcess = If( json?.PropertyT("totalBytesToProcess"), out var __jsonTotalBytesToProcess) ? (long?)__jsonTotalBytesToProcess : _totalBytesToProcess;} + {_filesProcessed = If( json?.PropertyT("filesProcessed"), out var __jsonFilesProcessed) ? (long?)__jsonFilesProcessed : _filesProcessed;} + {_totalFilesToProcess = If( json?.PropertyT("totalFilesToProcess"), out var __jsonTotalFilesToProcess) ? (long?)__jsonTotalFilesToProcess : _totalFilesToProcess;} + {_invalidFilesProcessed = If( json?.PropertyT("invalidFilesProcessed"), out var __jsonInvalidFilesProcessed) ? (long?)__jsonInvalidFilesProcessed : _invalidFilesProcessed;} + {_invalidFileBytesUploaded = If( json?.PropertyT("invalidFileBytesUploaded"), out var __jsonInvalidFileBytesUploaded) ? (long?)__jsonInvalidFileBytesUploaded : _invalidFileBytesUploaded;} + {_renamedContainerCount = If( json?.PropertyT("renamedContainerCount"), out var __jsonRenamedContainerCount) ? (long?)__jsonRenamedContainerCount : _renamedContainerCount;} + {_filesErroredOut = If( json?.PropertyT("filesErroredOut"), out var __jsonFilesErroredOut) ? (long?)__jsonFilesErroredOut : _filesErroredOut;} + {_directoriesErroredOut = If( json?.PropertyT("directoriesErroredOut"), out var __jsonDirectoriesErroredOut) ? (long?)__jsonDirectoriesErroredOut : _directoriesErroredOut;} + {_invalidDirectoriesProcessed = If( json?.PropertyT("invalidDirectoriesProcessed"), out var __jsonInvalidDirectoriesProcessed) ? (long?)__jsonInvalidDirectoriesProcessed : _invalidDirectoriesProcessed;} + {_isEnumerationInProgress = If( json?.PropertyT("isEnumerationInProgress"), out var __jsonIsEnumerationInProgress) ? (bool?)__jsonIsEnumerationInProgress : _isEnumerationInProgress;} + {_action = If( json?.PropertyT("actions"), out var __jsonActions) ? If( __jsonActions as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _action;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgress. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgress. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgress FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new CopyProgress(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._storageAccountName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._storageAccountName.ToString()) : null, "storageAccountName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._transferType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._transferType.ToString()) : null, "transferType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._dataAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._dataAccountType.ToString()) : null, "dataAccountType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._accountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._accountId.ToString()) : null, "accountId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._bytesProcessed ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._bytesProcessed) : null, "bytesProcessed" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalBytesToProcess ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._totalBytesToProcess) : null, "totalBytesToProcess" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._filesProcessed ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._filesProcessed) : null, "filesProcessed" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalFilesToProcess ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._totalFilesToProcess) : null, "totalFilesToProcess" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._invalidFilesProcessed ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._invalidFilesProcessed) : null, "invalidFilesProcessed" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._invalidFileBytesUploaded ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._invalidFileBytesUploaded) : null, "invalidFileBytesUploaded" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._renamedContainerCount ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._renamedContainerCount) : null, "renamedContainerCount" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._filesErroredOut ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._filesErroredOut) : null, "filesErroredOut" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._directoriesErroredOut ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._directoriesErroredOut) : null, "directoriesErroredOut" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._invalidDirectoriesProcessed ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._invalidDirectoriesProcessed) : null, "invalidDirectoriesProcessed" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._isEnumerationInProgress ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._isEnumerationInProgress) : null, "isEnumerationInProgress" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._action) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._action ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("actions",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.PowerShell.cs new file mode 100644 index 00000000000..dec0d938da6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// It does all pre-job creation validations. + [System.ComponentModel.TypeConverter(typeof(CreateJobValidationsTypeConverter))] + public partial class CreateJobValidations + { + + /// + /// 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 CreateJobValidations(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ValidationCategory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).ValidationCategory = (string) content.GetValueForProperty("ValidationCategory",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).ValidationCategory, global::System.Convert.ToString); + } + if (content.Contains("IndividualRequestDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).IndividualRequestDetail = (System.Collections.Generic.List) content.GetValueForProperty("IndividualRequestDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).IndividualRequestDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequestTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreateJobValidations(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ValidationCategory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).ValidationCategory = (string) content.GetValueForProperty("ValidationCategory",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).ValidationCategory, global::System.Convert.ToString); + } + if (content.Contains("IndividualRequestDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).IndividualRequestDetail = (System.Collections.Generic.List) content.GetValueForProperty("IndividualRequestDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).IndividualRequestDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequestTypeConverter.ConvertFrom)); + } + 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.DataBox.Models.ICreateJobValidations DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateJobValidations(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.DataBox.Models.ICreateJobValidations DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateJobValidations(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.DataBox.Models.ICreateJobValidations FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// It does all pre-job creation validations. + [System.ComponentModel.TypeConverter(typeof(CreateJobValidationsTypeConverter))] + public partial interface ICreateJobValidations + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.TypeConverter.cs new file mode 100644 index 00000000000..2ffbd1a1529 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateJobValidationsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateJobValidations ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateJobValidations).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateJobValidations.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateJobValidations.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateJobValidations.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.cs new file mode 100644 index 00000000000..fcc3de1e885 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// It does all pre-job creation validations. + public partial class CreateJobValidations : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateJobValidations, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateJobValidationsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest __validationRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationRequest(); + + /// + /// List of request details contain validationType and its request as key and value respectively. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List IndividualRequestDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)__validationRequest).IndividualRequestDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)__validationRequest).IndividualRequestDetail = value ; } + + /// Internal Acessors for ValidationCategory + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal.ValidationCategory { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)__validationRequest).ValidationCategory; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)__validationRequest).ValidationCategory = value ; } + + /// Identify the nature of validation. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationCategory { get => "JobCreationValidation"; } + + /// Creates an new instance. + public CreateJobValidations() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationRequest), __validationRequest); + await eventListener.AssertObjectIsValid(nameof(__validationRequest), __validationRequest); + } + } + /// It does all pre-job creation validations. + public partial interface ICreateJobValidations : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest + { + + } + /// It does all pre-job creation validations. + internal partial interface ICreateJobValidationsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.json.cs new file mode 100644 index 00000000000..7cdcbcf9abb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateJobValidations.json.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// It does all pre-job creation validations. + public partial class CreateJobValidations + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal CreateJobValidations(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationRequest(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateJobValidations. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateJobValidations. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateJobValidations FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new CreateJobValidations(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationRequest?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.PowerShell.cs new file mode 100644 index 00000000000..876da6e88a8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.PowerShell.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request to validate create order limit for current subscription. + [System.ComponentModel.TypeConverter(typeof(CreateOrderLimitForSubscriptionValidationRequestTypeConverter))] + public partial class CreateOrderLimitForSubscriptionValidationRequest + { + + /// + /// 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 CreateOrderLimitForSubscriptionValidationRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeviceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequestInternal)this).DeviceType = (string) content.GetValueForProperty("DeviceType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequestInternal)this).DeviceType, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequestInternal)this).Model, global::System.Convert.ToString); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, 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 CreateOrderLimitForSubscriptionValidationRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeviceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequestInternal)this).DeviceType = (string) content.GetValueForProperty("DeviceType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequestInternal)this).DeviceType, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequestInternal)this).Model, global::System.Convert.ToString); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, 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.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateOrderLimitForSubscriptionValidationRequest(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.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateOrderLimitForSubscriptionValidationRequest(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.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Request to validate create order limit for current subscription. + [System.ComponentModel.TypeConverter(typeof(CreateOrderLimitForSubscriptionValidationRequestTypeConverter))] + public partial interface ICreateOrderLimitForSubscriptionValidationRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.TypeConverter.cs new file mode 100644 index 00000000000..219a631d936 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateOrderLimitForSubscriptionValidationRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateOrderLimitForSubscriptionValidationRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateOrderLimitForSubscriptionValidationRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateOrderLimitForSubscriptionValidationRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.cs new file mode 100644 index 00000000000..49b7c6056a1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request to validate create order limit for current subscription. + public partial class CreateOrderLimitForSubscriptionValidationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequestInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest __validationInputRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest(); + + /// Backing field for property. + private string _deviceType; + + /// Device type to be used for the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DeviceType { get => this._deviceType; set => this._deviceType = value; } + + /// Backing field for property. + private string _model; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Model { get => this._model; set => this._model = value; } + + /// Identifies the type of validation request. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationType { get => "ValidateCreateOrderLimit"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)__validationInputRequest).ValidationType = "ValidateCreateOrderLimit"; } + + /// + /// Creates an new instance. + /// + public CreateOrderLimitForSubscriptionValidationRequest() + { + this.__validationInputRequest.ValidationType = "ValidateCreateOrderLimit"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationInputRequest), __validationInputRequest); + await eventListener.AssertObjectIsValid(nameof(__validationInputRequest), __validationInputRequest); + } + } + /// Request to validate create order limit for current subscription. + public partial interface ICreateOrderLimitForSubscriptionValidationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest + { + /// Device type to be used for the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Device type to be used for the job.", + SerializedName = @"deviceType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DeviceType { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + + } + /// Request to validate create order limit for current subscription. + internal partial interface ICreateOrderLimitForSubscriptionValidationRequestInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal + { + /// Device type to be used for the job. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DeviceType { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.json.cs new file mode 100644 index 00000000000..302008d8f8c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationRequest.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request to validate create order limit for current subscription. + public partial class CreateOrderLimitForSubscriptionValidationRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal CreateOrderLimitForSubscriptionValidationRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationInputRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest(json); + {_deviceType = If( json?.PropertyT("deviceType"), out var __jsonDeviceType) ? (string)__jsonDeviceType : (string)_deviceType;} + {_model = If( json?.PropertyT("model"), out var __jsonModel) ? (string)__jsonModel : (string)_model;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new CreateOrderLimitForSubscriptionValidationRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationInputRequest?.ToJson(container, serializationMode); + AddIf( null != (((object)this._deviceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._deviceType.ToString()) : null, "deviceType" ,container.Add ); + AddIf( null != (((object)this._model)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._model.ToString()) : null, "model" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.PowerShell.cs new file mode 100644 index 00000000000..2b4819093ca --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.PowerShell.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Properties of create order limit for subscription validation response. + [System.ComponentModel.TypeConverter(typeof(CreateOrderLimitForSubscriptionValidationResponsePropertiesTypeConverter))] + public partial class CreateOrderLimitForSubscriptionValidationResponseProperties + { + + /// + /// 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 CreateOrderLimitForSubscriptionValidationResponseProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponsePropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponsePropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, 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 CreateOrderLimitForSubscriptionValidationResponseProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponsePropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponsePropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, 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.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponseProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateOrderLimitForSubscriptionValidationResponseProperties(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.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponseProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateOrderLimitForSubscriptionValidationResponseProperties(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.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponseProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 create order limit for subscription validation response. + [System.ComponentModel.TypeConverter(typeof(CreateOrderLimitForSubscriptionValidationResponsePropertiesTypeConverter))] + public partial interface ICreateOrderLimitForSubscriptionValidationResponseProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.TypeConverter.cs new file mode 100644 index 00000000000..32d6f0150f6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateOrderLimitForSubscriptionValidationResponsePropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponseProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponseProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateOrderLimitForSubscriptionValidationResponseProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateOrderLimitForSubscriptionValidationResponseProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateOrderLimitForSubscriptionValidationResponseProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.cs new file mode 100644 index 00000000000..3e173c8cea4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of create order limit for subscription validation response. + public partial class CreateOrderLimitForSubscriptionValidationResponseProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponseProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponsePropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse __validationInputResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse(); + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail; } + + /// Error code and message of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error = value ?? null /* model class */; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message; } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponsePropertiesInternal.Status { get => this._status; set { {_status = value;} } } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error = value ?? null /* model class */; } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target = value ?? null; } + + /// Backing field for property. + private string _status; + + /// Create order limit validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Status { get => this._status; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target; } + + /// Identifies the type of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationType { get => "ValidateCreateOrderLimit"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).ValidationType = "ValidateCreateOrderLimit"; } + + /// + /// Creates an new instance. + /// + public CreateOrderLimitForSubscriptionValidationResponseProperties() + { + this.__validationInputResponse.ValidationType = "ValidateCreateOrderLimit"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationInputResponse), __validationInputResponse); + await eventListener.AssertObjectIsValid(nameof(__validationInputResponse), __validationInputResponse); + } + } + /// Properties of create order limit for subscription validation response. + public partial interface ICreateOrderLimitForSubscriptionValidationResponseProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse + { + /// Create order limit validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Create order limit validation status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Skipped")] + string Status { get; } + + } + /// Properties of create order limit for subscription validation response. + internal partial interface ICreateOrderLimitForSubscriptionValidationResponsePropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal + { + /// Create order limit validation status. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Skipped")] + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.json.cs new file mode 100644 index 00000000000..2bf8113e375 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CreateOrderLimitForSubscriptionValidationResponseProperties.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of create order limit for subscription validation response. + public partial class CreateOrderLimitForSubscriptionValidationResponseProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal CreateOrderLimitForSubscriptionValidationResponseProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationInputResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse(json); + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponseProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponseProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationResponseProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new CreateOrderLimitForSubscriptionValidationResponseProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationInputResponse?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.PowerShell.cs new file mode 100644 index 00000000000..564e9f9e55a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.PowerShell.cs @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The secrets related to customer disk job. + [System.ComponentModel.TypeConverter(typeof(CustomerDiskJobSecretsTypeConverter))] + public partial class CustomerDiskJobSecrets + { + + /// + /// 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 CustomerDiskJobSecrets(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskSecret")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecretsInternal)this).DiskSecret = (System.Collections.Generic.List) content.GetValueForProperty("DiskSecret",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecretsInternal)this).DiskSecret, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DiskSecretTypeConverter.ConvertFrom)); + } + if (content.Contains("CarrierAccountNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecretsInternal)this).CarrierAccountNumber = (System.Security.SecureString) content.GetValueForProperty("CarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecretsInternal)this).CarrierAccountNumber, (object ss) => (System.Security.SecureString)ss); + } + if (content.Contains("DcAccessSecurityCodeReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode) content.GetValueForProperty("DcAccessSecurityCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCodeTypeConverter.ConvertFrom); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type, 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 CustomerDiskJobSecrets(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskSecret")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecretsInternal)this).DiskSecret = (System.Collections.Generic.List) content.GetValueForProperty("DiskSecret",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecretsInternal)this).DiskSecret, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DiskSecretTypeConverter.ConvertFrom)); + } + if (content.Contains("CarrierAccountNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecretsInternal)this).CarrierAccountNumber = (System.Security.SecureString) content.GetValueForProperty("CarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecretsInternal)this).CarrierAccountNumber, (object ss) => (System.Security.SecureString)ss); + } + if (content.Contains("DcAccessSecurityCodeReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode) content.GetValueForProperty("DcAccessSecurityCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCodeTypeConverter.ConvertFrom); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type, 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.DataBox.Models.ICustomerDiskJobSecrets DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CustomerDiskJobSecrets(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.DataBox.Models.ICustomerDiskJobSecrets DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CustomerDiskJobSecrets(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.DataBox.Models.ICustomerDiskJobSecrets FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 secrets related to customer disk job. + [System.ComponentModel.TypeConverter(typeof(CustomerDiskJobSecretsTypeConverter))] + public partial interface ICustomerDiskJobSecrets + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.TypeConverter.cs new file mode 100644 index 00000000000..8289654d97b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CustomerDiskJobSecretsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecrets ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecrets).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CustomerDiskJobSecrets.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CustomerDiskJobSecrets.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CustomerDiskJobSecrets.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.cs new file mode 100644 index 00000000000..c3256edd6b0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The secrets related to customer disk job. + public partial class CustomerDiskJobSecrets : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecrets, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecretsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets __jobSecrets = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecrets(); + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).AdditionalInfo; } + + /// Backing field for property. + private System.Security.SecureString _carrierAccountNumber; + + /// Carrier Account Number of the customer + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Security.SecureString CarrierAccountNumber { get => this._carrierAccountNumber; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Code; } + + /// Dc Access Security Code for Customer Managed Shipping + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode DcAccessSecurityCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode = value ?? null /* model class */; } + + /// Forward Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DcAccessSecurityCodeForwardDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeForwardDcAccessCode; } + + /// Reverse Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DcAccessSecurityCodeReverseDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeReverseDcAccessCode; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Detail; } + + /// Backing field for property. + private System.Collections.Generic.List _diskSecret; + + /// Contains the list of secrets object for that device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List DiskSecret { get => this._diskSecret; } + + /// Error while fetching the secrets. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error = value ?? null /* model class */; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Message; } + + /// Internal Acessors for CarrierAccountNumber + System.Security.SecureString Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecretsInternal.CarrierAccountNumber { get => this._carrierAccountNumber; set { {_carrierAccountNumber = value;} } } + + /// Internal Acessors for DiskSecret + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecretsInternal.DiskSecret { get => this._diskSecret; set { {_diskSecret = value;} } } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Code = value ?? null; } + + /// Internal Acessors for DcAccessSecurityCode + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode = value ?? null /* model class */; } + + /// Internal Acessors for DcAccessSecurityCodeForwardDcAccessCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCodeForwardDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeForwardDcAccessCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeForwardDcAccessCode = value ?? null; } + + /// Internal Acessors for DcAccessSecurityCodeReverseDcAccessCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCodeReverseDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeReverseDcAccessCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeReverseDcAccessCode = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error = value ?? null /* model class */; } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Target = value ?? null; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Target; } + + /// Used to indicate what type of job secrets object. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => "DataBoxCustomerDisk"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Type = "DataBoxCustomerDisk"; } + + /// Creates an new instance. + public CustomerDiskJobSecrets() + { + this.__jobSecrets.Type = "DataBoxCustomerDisk"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobSecrets), __jobSecrets); + await eventListener.AssertObjectIsValid(nameof(__jobSecrets), __jobSecrets); + } + } + /// The secrets related to customer disk job. + public partial interface ICustomerDiskJobSecrets : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets + { + /// Carrier Account Number of the customer + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Carrier Account Number of the customer", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(System.Security.SecureString) })] + System.Security.SecureString CarrierAccountNumber { get; } + /// Contains the list of secrets object for that device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Contains the list of secrets object for that device.", + SerializedName = @"diskSecrets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecret) })] + System.Collections.Generic.List DiskSecret { get; } + + } + /// The secrets related to customer disk job. + internal partial interface ICustomerDiskJobSecretsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal + { + /// Carrier Account Number of the customer + System.Security.SecureString CarrierAccountNumber { get; set; } + /// Contains the list of secrets object for that device. + System.Collections.Generic.List DiskSecret { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.json.cs new file mode 100644 index 00000000000..d0b2c3d255d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/CustomerDiskJobSecrets.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The secrets related to customer disk job. + public partial class CustomerDiskJobSecrets + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal CustomerDiskJobSecrets(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobSecrets = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecrets(json); + {_diskSecret = If( json?.PropertyT("diskSecrets"), out var __jsonDiskSecrets) ? If( __jsonDiskSecrets as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDiskSecret) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DiskSecret.FromJson(__u) )) ))() : null : _diskSecret;} + {_carrierAccountNumber = If( json?.PropertyT("carrierAccountNumber"), out var __jsonCarrierAccountNumber) ? new System.Net.NetworkCredential("",(string)__jsonCarrierAccountNumber).SecurePassword : _carrierAccountNumber;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecrets. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecrets. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICustomerDiskJobSecrets FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new CustomerDiskJobSecrets(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobSecrets?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._diskSecret) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._diskSecret ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("diskSecrets",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._carrierAccountNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(System.Runtime.InteropServices.Marshal.PtrToStringBSTR(System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this._carrierAccountNumber))) : null, "carrierAccountNumber" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.PowerShell.cs new file mode 100644 index 00000000000..9bbd3040932 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Account details of the data to be transferred + [System.ComponentModel.TypeConverter(typeof(DataAccountDetailsTypeConverter))] + public partial class DataAccountDetails + { + + /// + /// 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 DataAccountDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("SharePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).SharePassword = (System.Security.SecureString) content.GetValueForProperty("SharePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).SharePassword, (object ss) => (System.Security.SecureString)ss); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DataAccountDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("SharePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).SharePassword = (System.Security.SecureString) content.GetValueForProperty("SharePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).SharePassword, (object ss) => (System.Security.SecureString)ss); + } + 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.DataBox.Models.IDataAccountDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataAccountDetails(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.DataBox.Models.IDataAccountDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataAccountDetails(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.DataBox.Models.IDataAccountDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Account details of the data to be transferred + [System.ComponentModel.TypeConverter(typeof(DataAccountDetailsTypeConverter))] + public partial interface IDataAccountDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.TypeConverter.cs new file mode 100644 index 00000000000..85839eb63ca --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataAccountDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataAccountDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataAccountDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataAccountDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.cs new file mode 100644 index 00000000000..e0f008d67af --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Account details of the data to be transferred + public partial class DataAccountDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal + { + + /// Backing field for property. + private string _dataAccountType; + + /// Account Type of the data to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DataAccountType { get => this._dataAccountType; set => this._dataAccountType = value; } + + /// Backing field for property. + private System.Security.SecureString _sharePassword; + + /// + /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If + /// this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements + /// : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one + /// number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, + /// numbers and these characters : @#\-$%^!+=;:_()]+ + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Security.SecureString SharePassword { get => this._sharePassword; set => this._sharePassword = value; } + + /// Creates an new instance. + public DataAccountDetails() + { + + } + } + /// Account details of the data to be transferred + public partial interface IDataAccountDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Account Type of the data to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Account Type of the data to be transferred.", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string DataAccountType { get; set; } + /// + /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If + /// this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements + /// : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one + /// number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, + /// numbers and these characters : @#\-$%^!+=;:_()]+ + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = false, + Create = true, + Update = false, + Description = @"Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+", + SerializedName = @"sharePassword", + PossibleTypes = new [] { typeof(System.Security.SecureString) })] + System.Security.SecureString SharePassword { get; set; } + + } + /// Account details of the data to be transferred + internal partial interface IDataAccountDetailsInternal + + { + /// Account Type of the data to be transferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string DataAccountType { get; set; } + /// + /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If + /// this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements + /// : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one + /// number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, + /// numbers and these characters : @#\-$%^!+=;:_()]+ + /// + System.Security.SecureString SharePassword { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.json.cs new file mode 100644 index 00000000000..fa772897b5a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataAccountDetails.json.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Account details of the data to be transferred + public partial class DataAccountDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataAccountDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_dataAccountType = If( json?.PropertyT("dataAccountType"), out var __jsonDataAccountType) ? (string)__jsonDataAccountType : (string)_dataAccountType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails interface is polymorphic, and the precise + /// model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("dataAccountType") ) + { + case "ManagedDisk": + { + return new ManagedDiskDetails(json); + } + case "StorageAccount": + { + return new StorageAccountDetails(json); + } + } + return new DataAccountDetails(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._dataAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._dataAccountType.ToString()) : null, "dataAccountType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._sharePassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(System.Runtime.InteropServices.Marshal.PtrToStringBSTR(System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this._sharePassword))) : null, "sharePassword" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.PowerShell.cs new file mode 100644 index 00000000000..0ca43ea930c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Copy log details for a storage account of a DataBox job + [System.ComponentModel.TypeConverter(typeof(DataBoxAccountCopyLogDetailsTypeConverter))] + public partial class DataBoxAccountCopyLogDetails + { + + /// + /// 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 DataBoxAccountCopyLogDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal)this).AccountName = (string) content.GetValueForProperty("AccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal)this).AccountName, global::System.Convert.ToString); + } + if (content.Contains("CopyLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal)this).CopyLogLink = (string) content.GetValueForProperty("CopyLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal)this).CopyLogLink, global::System.Convert.ToString); + } + if (content.Contains("CopyVerboseLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal)this).CopyVerboseLogLink = (string) content.GetValueForProperty("CopyVerboseLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal)this).CopyVerboseLogLink, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type, 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 DataBoxAccountCopyLogDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal)this).AccountName = (string) content.GetValueForProperty("AccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal)this).AccountName, global::System.Convert.ToString); + } + if (content.Contains("CopyLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal)this).CopyLogLink = (string) content.GetValueForProperty("CopyLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal)this).CopyLogLink, global::System.Convert.ToString); + } + if (content.Contains("CopyVerboseLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal)this).CopyVerboseLogLink = (string) content.GetValueForProperty("CopyVerboseLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal)this).CopyVerboseLogLink, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type, 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.DataBox.Models.IDataBoxAccountCopyLogDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxAccountCopyLogDetails(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.DataBox.Models.IDataBoxAccountCopyLogDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxAccountCopyLogDetails(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.DataBox.Models.IDataBoxAccountCopyLogDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Copy log details for a storage account of a DataBox job + [System.ComponentModel.TypeConverter(typeof(DataBoxAccountCopyLogDetailsTypeConverter))] + public partial interface IDataBoxAccountCopyLogDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.TypeConverter.cs new file mode 100644 index 00000000000..72fd55dc573 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxAccountCopyLogDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxAccountCopyLogDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxAccountCopyLogDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxAccountCopyLogDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.cs new file mode 100644 index 00000000000..a84713c858f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Copy log details for a storage account of a DataBox job + public partial class DataBoxAccountCopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails __copyLogDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetails(); + + /// Backing field for property. + private string _accountName; + + /// Account name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string AccountName { get => this._accountName; } + + /// Backing field for property. + private string _copyLogLink; + + /// Link for copy logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CopyLogLink { get => this._copyLogLink; } + + /// Backing field for property. + private string _copyVerboseLogLink; + + /// + /// Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CopyVerboseLogLink { get => this._copyVerboseLogLink; } + + /// Internal Acessors for AccountName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal.AccountName { get => this._accountName; set { {_accountName = value;} } } + + /// Internal Acessors for CopyLogLink + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal.CopyLogLink { get => this._copyLogLink; set { {_copyLogLink = value;} } } + + /// Internal Acessors for CopyVerboseLogLink + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetailsInternal.CopyVerboseLogLink { get => this._copyVerboseLogLink; set { {_copyVerboseLogLink = value;} } } + + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => "DataBox"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)__copyLogDetails).Type = "DataBox"; } + + /// Creates an new instance. + public DataBoxAccountCopyLogDetails() + { + this.__copyLogDetails.Type = "DataBox"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__copyLogDetails), __copyLogDetails); + await eventListener.AssertObjectIsValid(nameof(__copyLogDetails), __copyLogDetails); + } + } + /// Copy log details for a storage account of a DataBox job + public partial interface IDataBoxAccountCopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails + { + /// Account name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Account name.", + SerializedName = @"accountName", + PossibleTypes = new [] { typeof(string) })] + string AccountName { get; } + /// Link for copy logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Link for copy logs.", + SerializedName = @"copyLogLink", + PossibleTypes = new [] { typeof(string) })] + string CopyLogLink { get; } + /// + /// Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose.", + SerializedName = @"copyVerboseLogLink", + PossibleTypes = new [] { typeof(string) })] + string CopyVerboseLogLink { get; } + + } + /// Copy log details for a storage account of a DataBox job + internal partial interface IDataBoxAccountCopyLogDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal + { + /// Account name. + string AccountName { get; set; } + /// Link for copy logs. + string CopyLogLink { get; set; } + /// + /// Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose. + /// + string CopyVerboseLogLink { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.json.cs new file mode 100644 index 00000000000..e92f798ad2e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxAccountCopyLogDetails.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Copy log details for a storage account of a DataBox job + public partial class DataBoxAccountCopyLogDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxAccountCopyLogDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __copyLogDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetails(json); + {_accountName = If( json?.PropertyT("accountName"), out var __jsonAccountName) ? (string)__jsonAccountName : (string)_accountName;} + {_copyLogLink = If( json?.PropertyT("copyLogLink"), out var __jsonCopyLogLink) ? (string)__jsonCopyLogLink : (string)_copyLogLink;} + {_copyVerboseLogLink = If( json?.PropertyT("copyVerboseLogLink"), out var __jsonCopyVerboseLogLink) ? (string)__jsonCopyVerboseLogLink : (string)_copyVerboseLogLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxAccountCopyLogDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxAccountCopyLogDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __copyLogDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._accountName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._accountName.ToString()) : null, "accountName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._copyLogLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._copyLogLink.ToString()) : null, "copyLogLink" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._copyVerboseLogLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._copyVerboseLogLink.ToString()) : null, "copyVerboseLogLink" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.PowerShell.cs new file mode 100644 index 00000000000..8dbbde1d57d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Copy Log Details for customer disk + [System.ComponentModel.TypeConverter(typeof(DataBoxCustomerDiskCopyLogDetailsTypeConverter))] + public partial class DataBoxCustomerDiskCopyLogDetails + { + + /// + /// 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 DataBoxCustomerDiskCopyLogDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal)this).SerialNumber = (string) content.GetValueForProperty("SerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal)this).SerialNumber, global::System.Convert.ToString); + } + if (content.Contains("ErrorLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal)this).ErrorLogLink = (string) content.GetValueForProperty("ErrorLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal)this).ErrorLogLink, global::System.Convert.ToString); + } + if (content.Contains("VerboseLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal)this).VerboseLogLink = (string) content.GetValueForProperty("VerboseLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal)this).VerboseLogLink, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type, 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 DataBoxCustomerDiskCopyLogDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal)this).SerialNumber = (string) content.GetValueForProperty("SerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal)this).SerialNumber, global::System.Convert.ToString); + } + if (content.Contains("ErrorLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal)this).ErrorLogLink = (string) content.GetValueForProperty("ErrorLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal)this).ErrorLogLink, global::System.Convert.ToString); + } + if (content.Contains("VerboseLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal)this).VerboseLogLink = (string) content.GetValueForProperty("VerboseLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal)this).VerboseLogLink, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type, 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.DataBox.Models.IDataBoxCustomerDiskCopyLogDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxCustomerDiskCopyLogDetails(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.DataBox.Models.IDataBoxCustomerDiskCopyLogDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxCustomerDiskCopyLogDetails(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.DataBox.Models.IDataBoxCustomerDiskCopyLogDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Copy Log Details for customer disk + [System.ComponentModel.TypeConverter(typeof(DataBoxCustomerDiskCopyLogDetailsTypeConverter))] + public partial interface IDataBoxCustomerDiskCopyLogDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.TypeConverter.cs new file mode 100644 index 00000000000..0b8e2eee15e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxCustomerDiskCopyLogDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxCustomerDiskCopyLogDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxCustomerDiskCopyLogDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxCustomerDiskCopyLogDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.cs new file mode 100644 index 00000000000..524e080c30b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Copy Log Details for customer disk + public partial class DataBoxCustomerDiskCopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails __copyLogDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetails(); + + /// Backing field for property. + private string _errorLogLink; + + /// Link for copy error logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ErrorLogLink { get => this._errorLogLink; } + + /// Internal Acessors for ErrorLogLink + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal.ErrorLogLink { get => this._errorLogLink; set { {_errorLogLink = value;} } } + + /// Internal Acessors for SerialNumber + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal.SerialNumber { get => this._serialNumber; set { {_serialNumber = value;} } } + + /// Internal Acessors for VerboseLogLink + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetailsInternal.VerboseLogLink { get => this._verboseLogLink; set { {_verboseLogLink = value;} } } + + /// Backing field for property. + private string _serialNumber; + + /// Disk Serial Number. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string SerialNumber { get => this._serialNumber; } + + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => "DataBoxCustomerDisk"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)__copyLogDetails).Type = "DataBoxCustomerDisk"; } + + /// Backing field for property. + private string _verboseLogLink; + + /// Link for copy verbose logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string VerboseLogLink { get => this._verboseLogLink; } + + /// Creates an new instance. + public DataBoxCustomerDiskCopyLogDetails() + { + this.__copyLogDetails.Type = "DataBoxCustomerDisk"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__copyLogDetails), __copyLogDetails); + await eventListener.AssertObjectIsValid(nameof(__copyLogDetails), __copyLogDetails); + } + } + /// Copy Log Details for customer disk + public partial interface IDataBoxCustomerDiskCopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails + { + /// Link for copy error logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Link for copy error logs.", + SerializedName = @"errorLogLink", + PossibleTypes = new [] { typeof(string) })] + string ErrorLogLink { get; } + /// Disk Serial Number. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Disk Serial Number.", + SerializedName = @"serialNumber", + PossibleTypes = new [] { typeof(string) })] + string SerialNumber { get; } + /// Link for copy verbose logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Link for copy verbose logs.", + SerializedName = @"verboseLogLink", + PossibleTypes = new [] { typeof(string) })] + string VerboseLogLink { get; } + + } + /// Copy Log Details for customer disk + internal partial interface IDataBoxCustomerDiskCopyLogDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal + { + /// Link for copy error logs. + string ErrorLogLink { get; set; } + /// Disk Serial Number. + string SerialNumber { get; set; } + /// Link for copy verbose logs. + string VerboseLogLink { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.json.cs new file mode 100644 index 00000000000..c325c7937a2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyLogDetails.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Copy Log Details for customer disk + public partial class DataBoxCustomerDiskCopyLogDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxCustomerDiskCopyLogDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __copyLogDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetails(json); + {_serialNumber = If( json?.PropertyT("serialNumber"), out var __jsonSerialNumber) ? (string)__jsonSerialNumber : (string)_serialNumber;} + {_errorLogLink = If( json?.PropertyT("errorLogLink"), out var __jsonErrorLogLink) ? (string)__jsonErrorLogLink : (string)_errorLogLink;} + {_verboseLogLink = If( json?.PropertyT("verboseLogLink"), out var __jsonVerboseLogLink) ? (string)__jsonVerboseLogLink : (string)_verboseLogLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyLogDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxCustomerDiskCopyLogDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __copyLogDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._serialNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._serialNumber.ToString()) : null, "serialNumber" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._errorLogLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._errorLogLink.ToString()) : null, "errorLogLink" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._verboseLogLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._verboseLogLink.ToString()) : null, "verboseLogLink" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.PowerShell.cs new file mode 100644 index 00000000000..ee3c254a10d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.PowerShell.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// DataBox CustomerDisk Copy Progress + [System.ComponentModel.TypeConverter(typeof(DataBoxCustomerDiskCopyProgressTypeConverter))] + public partial class DataBoxCustomerDiskCopyProgress + { + + /// + /// 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 DataBoxCustomerDiskCopyProgress(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgressInternal)this).SerialNumber = (string) content.GetValueForProperty("SerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgressInternal)this).SerialNumber, global::System.Convert.ToString); + } + if (content.Contains("CopyStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgressInternal)this).CopyStatus = (string) content.GetValueForProperty("CopyStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgressInternal)this).CopyStatus, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("StorageAccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).StorageAccountName = (string) content.GetValueForProperty("StorageAccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).StorageAccountName, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AccountId = (string) content.GetValueForProperty("AccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AccountId, global::System.Convert.ToString); + } + if (content.Contains("BytesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).BytesProcessed = (long?) content.GetValueForProperty("BytesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).BytesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBytesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalBytesToProcess = (long?) content.GetValueForProperty("TotalBytesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalBytesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesProcessed = (long?) content.GetValueForProperty("FilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalFilesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalFilesToProcess = (long?) content.GetValueForProperty("TotalFilesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalFilesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFilesProcessed = (long?) content.GetValueForProperty("InvalidFilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFileBytesUploaded")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFileBytesUploaded = (long?) content.GetValueForProperty("InvalidFileBytesUploaded",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFileBytesUploaded, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RenamedContainerCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).RenamedContainerCount = (long?) content.GetValueForProperty("RenamedContainerCount",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).RenamedContainerCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesErroredOut = (long?) content.GetValueForProperty("FilesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DirectoriesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DirectoriesErroredOut = (long?) content.GetValueForProperty("DirectoriesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DirectoriesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidDirectoriesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidDirectoriesProcessed = (long?) content.GetValueForProperty("InvalidDirectoriesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidDirectoriesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IsEnumerationInProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).IsEnumerationInProgress = (bool?) content.GetValueForProperty("IsEnumerationInProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).IsEnumerationInProgress, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, 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 DataBoxCustomerDiskCopyProgress(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgressInternal)this).SerialNumber = (string) content.GetValueForProperty("SerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgressInternal)this).SerialNumber, global::System.Convert.ToString); + } + if (content.Contains("CopyStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgressInternal)this).CopyStatus = (string) content.GetValueForProperty("CopyStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgressInternal)this).CopyStatus, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("StorageAccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).StorageAccountName = (string) content.GetValueForProperty("StorageAccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).StorageAccountName, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AccountId = (string) content.GetValueForProperty("AccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).AccountId, global::System.Convert.ToString); + } + if (content.Contains("BytesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).BytesProcessed = (long?) content.GetValueForProperty("BytesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).BytesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBytesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalBytesToProcess = (long?) content.GetValueForProperty("TotalBytesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalBytesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesProcessed = (long?) content.GetValueForProperty("FilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalFilesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalFilesToProcess = (long?) content.GetValueForProperty("TotalFilesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).TotalFilesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFilesProcessed = (long?) content.GetValueForProperty("InvalidFilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFileBytesUploaded")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFileBytesUploaded = (long?) content.GetValueForProperty("InvalidFileBytesUploaded",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidFileBytesUploaded, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RenamedContainerCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).RenamedContainerCount = (long?) content.GetValueForProperty("RenamedContainerCount",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).RenamedContainerCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesErroredOut = (long?) content.GetValueForProperty("FilesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).FilesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DirectoriesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DirectoriesErroredOut = (long?) content.GetValueForProperty("DirectoriesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).DirectoriesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidDirectoriesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidDirectoriesProcessed = (long?) content.GetValueForProperty("InvalidDirectoriesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).InvalidDirectoriesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IsEnumerationInProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).IsEnumerationInProgress = (bool?) content.GetValueForProperty("IsEnumerationInProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).IsEnumerationInProgress, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, 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.DataBox.Models.IDataBoxCustomerDiskCopyProgress DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxCustomerDiskCopyProgress(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.DataBox.Models.IDataBoxCustomerDiskCopyProgress DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxCustomerDiskCopyProgress(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.DataBox.Models.IDataBoxCustomerDiskCopyProgress FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// DataBox CustomerDisk Copy Progress + [System.ComponentModel.TypeConverter(typeof(DataBoxCustomerDiskCopyProgressTypeConverter))] + public partial interface IDataBoxCustomerDiskCopyProgress + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.TypeConverter.cs new file mode 100644 index 00000000000..c316bf510a0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxCustomerDiskCopyProgressTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgress ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgress).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxCustomerDiskCopyProgress.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxCustomerDiskCopyProgress.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxCustomerDiskCopyProgress.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.cs new file mode 100644 index 00000000000..fe72d64ec54 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.cs @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// DataBox CustomerDisk Copy Progress + public partial class DataBoxCustomerDiskCopyProgress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgress, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgressInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgress __copyProgress = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyProgress(); + + /// Id of the account where the data needs to be uploaded. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string AccountId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).AccountId; } + + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Action; } + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).AdditionalInfo; } + + /// To indicate bytes transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? BytesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).BytesProcessed; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Code; } + + /// Backing field for property. + private string _copyStatus; + + /// The Status of the copy + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CopyStatus { get => this._copyStatus; } + + /// Data Account Type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DataAccountType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).DataAccountType; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Detail; } + + /// To indicate directories errored out in the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? DirectoriesErroredOut { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).DirectoriesErroredOut; } + + /// Error, if any, in the stage + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Error = value ?? null /* model class */; } + + /// Number of files which could not be copied + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? FilesErroredOut { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).FilesErroredOut; } + + /// Number of files processed + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? FilesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).FilesProcessed; } + + /// To indicate directories renamed + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? InvalidDirectoriesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).InvalidDirectoriesProcessed; } + + /// + /// Total amount of data not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? InvalidFileBytesUploaded { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).InvalidFileBytesUploaded; } + + /// + /// Number of files not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? InvalidFilesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).InvalidFilesProcessed; } + + /// + /// To indicate if enumeration of data is in progress. + /// Until this is true, the TotalBytesToProcess may not be valid. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? IsEnumerationInProgress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).IsEnumerationInProgress; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Message; } + + /// Internal Acessors for AccountId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.AccountId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).AccountId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).AccountId = value ?? null; } + + /// Internal Acessors for Action + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Action; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Action = value ?? null /* arrayOf */; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for BytesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.BytesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).BytesProcessed; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).BytesProcessed = value ?? default(long); } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Code = value ?? null; } + + /// Internal Acessors for DataAccountType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.DataAccountType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).DataAccountType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).DataAccountType = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for DirectoriesErroredOut + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.DirectoriesErroredOut { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).DirectoriesErroredOut; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).DirectoriesErroredOut = value ?? default(long); } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Error = value ?? null /* model class */; } + + /// Internal Acessors for FilesErroredOut + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.FilesErroredOut { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).FilesErroredOut; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).FilesErroredOut = value ?? default(long); } + + /// Internal Acessors for FilesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.FilesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).FilesProcessed; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).FilesProcessed = value ?? default(long); } + + /// Internal Acessors for InvalidDirectoriesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.InvalidDirectoriesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).InvalidDirectoriesProcessed; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).InvalidDirectoriesProcessed = value ?? default(long); } + + /// Internal Acessors for InvalidFileBytesUploaded + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.InvalidFileBytesUploaded { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).InvalidFileBytesUploaded; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).InvalidFileBytesUploaded = value ?? default(long); } + + /// Internal Acessors for InvalidFilesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.InvalidFilesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).InvalidFilesProcessed; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).InvalidFilesProcessed = value ?? default(long); } + + /// Internal Acessors for IsEnumerationInProgress + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.IsEnumerationInProgress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).IsEnumerationInProgress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).IsEnumerationInProgress = value ?? default(bool); } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Message = value ?? null; } + + /// Internal Acessors for RenamedContainerCount + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.RenamedContainerCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).RenamedContainerCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).RenamedContainerCount = value ?? default(long); } + + /// Internal Acessors for StorageAccountName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.StorageAccountName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).StorageAccountName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).StorageAccountName = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Target = value ?? null; } + + /// Internal Acessors for TotalBytesToProcess + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.TotalBytesToProcess { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).TotalBytesToProcess; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).TotalBytesToProcess = value ?? default(long); } + + /// Internal Acessors for TotalFilesToProcess + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.TotalFilesToProcess { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).TotalFilesToProcess; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).TotalFilesToProcess = value ?? default(long); } + + /// Internal Acessors for TransferType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal.TransferType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).TransferType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).TransferType = value ?? null; } + + /// Internal Acessors for CopyStatus + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgressInternal.CopyStatus { get => this._copyStatus; set { {_copyStatus = value;} } } + + /// Internal Acessors for SerialNumber + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgressInternal.SerialNumber { get => this._serialNumber; set { {_serialNumber = value;} } } + + /// + /// Number of folders not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? RenamedContainerCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).RenamedContainerCount; } + + /// Backing field for property. + private string _serialNumber; + + /// Disk Serial Number. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string SerialNumber { get => this._serialNumber; } + + /// + /// Name of the storage account. This will be empty for data account types other than storage account. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StorageAccountName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).StorageAccountName; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).Target; } + + /// Total amount of data to be processed by the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? TotalBytesToProcess { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).TotalBytesToProcess; } + + /// Total files to process + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? TotalFilesToProcess { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).TotalFilesToProcess; } + + /// Transfer type of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string TransferType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal)__copyProgress).TransferType; } + + /// Creates an new instance. + public DataBoxCustomerDiskCopyProgress() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__copyProgress), __copyProgress); + await eventListener.AssertObjectIsValid(nameof(__copyProgress), __copyProgress); + } + } + /// DataBox CustomerDisk Copy Progress + public partial interface IDataBoxCustomerDiskCopyProgress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgress + { + /// The Status of the copy + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The Status of the copy", + SerializedName = @"copyStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("NotStarted", "InProgress", "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", "DriveNotDetected", "DriveCorrupted", "MetadataFilesModifiedOrRemoved")] + string CopyStatus { get; } + /// Disk Serial Number. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Disk Serial Number.", + SerializedName = @"serialNumber", + PossibleTypes = new [] { typeof(string) })] + string SerialNumber { get; } + + } + /// DataBox CustomerDisk Copy Progress + internal partial interface IDataBoxCustomerDiskCopyProgressInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgressInternal + { + /// The Status of the copy + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("NotStarted", "InProgress", "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", "DriveNotDetected", "DriveCorrupted", "MetadataFilesModifiedOrRemoved")] + string CopyStatus { get; set; } + /// Disk Serial Number. + string SerialNumber { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.json.cs new file mode 100644 index 00000000000..325ecec2e5c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskCopyProgress.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// DataBox CustomerDisk Copy Progress + public partial class DataBoxCustomerDiskCopyProgress + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxCustomerDiskCopyProgress(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __copyProgress = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyProgress(json); + {_serialNumber = If( json?.PropertyT("serialNumber"), out var __jsonSerialNumber) ? (string)__jsonSerialNumber : (string)_serialNumber;} + {_copyStatus = If( json?.PropertyT("copyStatus"), out var __jsonCopyStatus) ? (string)__jsonCopyStatus : (string)_copyStatus;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgress. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgress. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgress FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxCustomerDiskCopyProgress(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __copyProgress?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._serialNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._serialNumber.ToString()) : null, "serialNumber" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._copyStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._copyStatus.ToString()) : null, "copyStatus" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.PowerShell.cs new file mode 100644 index 00000000000..52446f15a2f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.PowerShell.cs @@ -0,0 +1,962 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Customer disk job details. + [System.ComponentModel.TypeConverter(typeof(DataBoxCustomerDiskJobDetailsTypeConverter))] + public partial class DataBoxCustomerDiskJobDetails + { + + /// + /// 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 DataBoxCustomerDiskJobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeliverToDcPackageDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).DeliverToDcPackageDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo) content.GetValueForProperty("DeliverToDcPackageDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).DeliverToDcPackageDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnToCustomerPackageDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails) content.GetValueForProperty("ReturnToCustomerPackageDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ImportDiskDetailsCollection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ImportDiskDetailsCollection = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection) content.GetValueForProperty("ImportDiskDetailsCollection",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ImportDiskDetailsCollection, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskJobDetailsImportDiskDetailsCollectionTypeConverter.ConvertFrom); + } + if (content.Contains("ExportDiskDetailsCollection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ExportDiskDetailsCollection = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection) content.GetValueForProperty("ExportDiskDetailsCollection",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ExportDiskDetailsCollection, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskJobDetailsExportDiskDetailsCollectionTypeConverter.ConvertFrom); + } + if (content.Contains("CopyProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).CopyProgress = (System.Collections.Generic.List) content.GetValueForProperty("CopyProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).CopyProgress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskCopyProgressTypeConverter.ConvertFrom)); + } + if (content.Contains("EnableManifestBackup")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).EnableManifestBackup = (bool?) content.GetValueForProperty("EnableManifestBackup",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).EnableManifestBackup, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ContactDetailEmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailEmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContactDetailNotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailNotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ReverseShippingDetailShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyIdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("KeyEncryptionKeyIdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyKekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType = (string) content.GetValueForProperty("KeyEncryptionKeyKekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName = (string) content.GetValueForProperty("ContactDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone = (string) content.GetValueForProperty("ContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension = (string) content.GetValueForProperty("ContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile = (string) content.GetValueForProperty("ContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl = (string) content.GetValueForProperty("DeliveryPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId = (string) content.GetValueForProperty("DeliveryPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl = (string) content.GetValueForProperty("ReturnPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId = (string) content.GetValueForProperty("ReturnPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ReverseShippingDetailContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated = (bool?) content.GetValueForProperty("ReverseShippingDetailIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailDeviceErasureStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus = (string) content.GetValueForProperty("DeviceErasureDetailDeviceErasureStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailErasureOrDestructionCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailErasureOrDestructionCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailSecureErasureCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailSecureErasureCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl = (string) content.GetValueForProperty("KeyEncryptionKeyKekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId = (string) content.GetValueForProperty("KeyEncryptionKeyKekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("LastMitigationActionOnJobActionDateTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastMitigationActionOnJobActionDateTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMitigationActionOnJobIsPerformedByCustomer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer = (bool?) content.GetValueForProperty("LastMitigationActionOnJobIsPerformedByCustomer",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastMitigationActionOnJobCustomerResolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution = (string) content.GetValueForProperty("LastMitigationActionOnJobCustomerResolution",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressSupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("DatacenterAddressSupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DatacenterAddressDataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation = (string) content.GetValueForProperty("DatacenterAddressDataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName = (string) content.GetValueForProperty("ReverseShippingDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ReverseShippingDetailsShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId, global::System.Convert.ToString); + } + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails) content.GetValueForProperty("ReverseShippingDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceErasureDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails) content.GetValueForProperty("DeviceErasureDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey) content.GetValueForProperty("KeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKeyTypeConverter.ConvertFrom); + } + if (content.Contains("LastMitigationActionOnJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob) content.GetValueForProperty("LastMitigationActionOnJob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJobTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse) content.GetValueForProperty("DatacenterAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponseTypeConverter.ConvertFrom); + } + if (content.Contains("JobStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage = (System.Collections.Generic.List) content.GetValueForProperty("JobStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobStagesTypeConverter.ConvertFrom)); + } + if (content.Contains("DataImportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataImportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DataExportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataExportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CopyLogDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail = (System.Collections.Generic.List) content.GetValueForProperty("CopyLogDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReverseShipmentLabelSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey = (string) content.GetValueForProperty("ReverseShipmentLabelSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey, global::System.Convert.ToString); + } + if (content.Contains("ChainOfCustodySasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey = (string) content.GetValueForProperty("ChainOfCustodySasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey, global::System.Convert.ToString); + } + if (content.Contains("ExpectedDataSizeInTeraByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte = (int?) content.GetValueForProperty("ExpectedDataSizeInTeraByte",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode = (string) content.GetValueForProperty("DataCenterCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode, global::System.Convert.ToString); + } + if (content.Contains("DeliverToDcPackageDetailCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).DeliverToDcPackageDetailCarrierName = (string) content.GetValueForProperty("DeliverToDcPackageDetailCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).DeliverToDcPackageDetailCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliverToDcPackageDetailTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).DeliverToDcPackageDetailTrackingId = (string) content.GetValueForProperty("DeliverToDcPackageDetailTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).DeliverToDcPackageDetailTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReturnToCustomerPackageDetailCarrierAccountNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierAccountNumber = (System.Security.SecureString) content.GetValueForProperty("ReturnToCustomerPackageDetailCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierAccountNumber, (object ss) => (System.Security.SecureString)ss); + } + if (content.Contains("ReturnToCustomerPackageDetailCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierName = (string) content.GetValueForProperty("ReturnToCustomerPackageDetailCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnToCustomerPackageDetailTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetailTrackingId = (string) content.GetValueForProperty("ReturnToCustomerPackageDetailTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetailTrackingId, 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 DataBoxCustomerDiskJobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeliverToDcPackageDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).DeliverToDcPackageDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo) content.GetValueForProperty("DeliverToDcPackageDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).DeliverToDcPackageDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnToCustomerPackageDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails) content.GetValueForProperty("ReturnToCustomerPackageDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ImportDiskDetailsCollection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ImportDiskDetailsCollection = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection) content.GetValueForProperty("ImportDiskDetailsCollection",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ImportDiskDetailsCollection, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskJobDetailsImportDiskDetailsCollectionTypeConverter.ConvertFrom); + } + if (content.Contains("ExportDiskDetailsCollection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ExportDiskDetailsCollection = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection) content.GetValueForProperty("ExportDiskDetailsCollection",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ExportDiskDetailsCollection, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskJobDetailsExportDiskDetailsCollectionTypeConverter.ConvertFrom); + } + if (content.Contains("CopyProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).CopyProgress = (System.Collections.Generic.List) content.GetValueForProperty("CopyProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).CopyProgress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskCopyProgressTypeConverter.ConvertFrom)); + } + if (content.Contains("EnableManifestBackup")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).EnableManifestBackup = (bool?) content.GetValueForProperty("EnableManifestBackup",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).EnableManifestBackup, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ContactDetailEmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailEmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContactDetailNotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailNotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ReverseShippingDetailShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyIdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("KeyEncryptionKeyIdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyKekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType = (string) content.GetValueForProperty("KeyEncryptionKeyKekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName = (string) content.GetValueForProperty("ContactDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone = (string) content.GetValueForProperty("ContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension = (string) content.GetValueForProperty("ContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile = (string) content.GetValueForProperty("ContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl = (string) content.GetValueForProperty("DeliveryPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId = (string) content.GetValueForProperty("DeliveryPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl = (string) content.GetValueForProperty("ReturnPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId = (string) content.GetValueForProperty("ReturnPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ReverseShippingDetailContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated = (bool?) content.GetValueForProperty("ReverseShippingDetailIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailDeviceErasureStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus = (string) content.GetValueForProperty("DeviceErasureDetailDeviceErasureStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailErasureOrDestructionCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailErasureOrDestructionCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailSecureErasureCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailSecureErasureCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl = (string) content.GetValueForProperty("KeyEncryptionKeyKekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId = (string) content.GetValueForProperty("KeyEncryptionKeyKekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("LastMitigationActionOnJobActionDateTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastMitigationActionOnJobActionDateTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMitigationActionOnJobIsPerformedByCustomer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer = (bool?) content.GetValueForProperty("LastMitigationActionOnJobIsPerformedByCustomer",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastMitigationActionOnJobCustomerResolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution = (string) content.GetValueForProperty("LastMitigationActionOnJobCustomerResolution",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressSupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("DatacenterAddressSupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DatacenterAddressDataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation = (string) content.GetValueForProperty("DatacenterAddressDataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName = (string) content.GetValueForProperty("ReverseShippingDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ReverseShippingDetailsShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId, global::System.Convert.ToString); + } + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails) content.GetValueForProperty("ReverseShippingDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceErasureDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails) content.GetValueForProperty("DeviceErasureDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey) content.GetValueForProperty("KeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKeyTypeConverter.ConvertFrom); + } + if (content.Contains("LastMitigationActionOnJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob) content.GetValueForProperty("LastMitigationActionOnJob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJobTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse) content.GetValueForProperty("DatacenterAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponseTypeConverter.ConvertFrom); + } + if (content.Contains("JobStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage = (System.Collections.Generic.List) content.GetValueForProperty("JobStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobStagesTypeConverter.ConvertFrom)); + } + if (content.Contains("DataImportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataImportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DataExportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataExportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CopyLogDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail = (System.Collections.Generic.List) content.GetValueForProperty("CopyLogDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReverseShipmentLabelSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey = (string) content.GetValueForProperty("ReverseShipmentLabelSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey, global::System.Convert.ToString); + } + if (content.Contains("ChainOfCustodySasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey = (string) content.GetValueForProperty("ChainOfCustodySasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey, global::System.Convert.ToString); + } + if (content.Contains("ExpectedDataSizeInTeraByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte = (int?) content.GetValueForProperty("ExpectedDataSizeInTeraByte",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode = (string) content.GetValueForProperty("DataCenterCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode, global::System.Convert.ToString); + } + if (content.Contains("DeliverToDcPackageDetailCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).DeliverToDcPackageDetailCarrierName = (string) content.GetValueForProperty("DeliverToDcPackageDetailCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).DeliverToDcPackageDetailCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliverToDcPackageDetailTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).DeliverToDcPackageDetailTrackingId = (string) content.GetValueForProperty("DeliverToDcPackageDetailTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).DeliverToDcPackageDetailTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReturnToCustomerPackageDetailCarrierAccountNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierAccountNumber = (System.Security.SecureString) content.GetValueForProperty("ReturnToCustomerPackageDetailCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierAccountNumber, (object ss) => (System.Security.SecureString)ss); + } + if (content.Contains("ReturnToCustomerPackageDetailCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierName = (string) content.GetValueForProperty("ReturnToCustomerPackageDetailCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnToCustomerPackageDetailTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetailTrackingId = (string) content.GetValueForProperty("ReturnToCustomerPackageDetailTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal)this).ReturnToCustomerPackageDetailTrackingId, 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.DataBox.Models.IDataBoxCustomerDiskJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxCustomerDiskJobDetails(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.DataBox.Models.IDataBoxCustomerDiskJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxCustomerDiskJobDetails(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.DataBox.Models.IDataBoxCustomerDiskJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Customer disk job details. + [System.ComponentModel.TypeConverter(typeof(DataBoxCustomerDiskJobDetailsTypeConverter))] + public partial interface IDataBoxCustomerDiskJobDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.TypeConverter.cs new file mode 100644 index 00000000000..a4f40ecf917 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxCustomerDiskJobDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxCustomerDiskJobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxCustomerDiskJobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxCustomerDiskJobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.cs new file mode 100644 index 00000000000..372838470ad --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.cs @@ -0,0 +1,747 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Customer disk job details. + public partial class DataBoxCustomerDiskJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetails(); + + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Action; } + + /// Shared access key to download the chain of custody logs + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ChainOfCustodySasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ChainOfCustodySasKey; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string City { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).City = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string CompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CompanyName = value ?? null; } + + /// Contact details for notification and shipping. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails ContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail = value ?? null /* model class */; } + + /// List of Email-ids to be notified about job progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List ContactDetailEmailList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailEmailList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailEmailList = value ; } + + /// Notification preference for a job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List ContactDetailNotificationPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailNotificationPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailNotificationPreference = value ?? null /* arrayOf */; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsContactName = value ; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsMobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsMobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhone = value ; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhoneExtension = value ?? null; } + + /// List of copy log details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List CopyLogDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CopyLogDetail; } + + /// Backing field for property. + private System.Collections.Generic.List _copyProgress; + + /// Copy progress per disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List CopyProgress { get => this._copyProgress; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Country { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Country = value ?? null; } + + /// DataCenter code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DataCenterCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataCenterCode; } + + /// Details of the data to be exported from azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List DataExportDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataExportDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataExportDetail = value ?? null /* arrayOf */; } + + /// Details of the data to be imported into azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List DataImportDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataImportDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataImportDetail = value ?? null /* arrayOf */; } + + /// Datacenter address to ship to, for the given sku and storage location. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse DatacenterAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress = value ?? null /* model class */; } + + /// Azure Location where the Data Center serves primarily. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DatacenterAddressDataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressDataCenterAzureLocation; } + + /// List of supported carriers for return shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List DatacenterAddressSupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressSupportedCarriersForReturnShipment; } + + /// Data center address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DatacenterAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressType; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo _deliverToDcPackageDetail; + + /// Delivery package shipping details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo DeliverToDcPackageDetail { get => (this._deliverToDcPackageDetail = this._deliverToDcPackageDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierInfo()); } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeliverToDcPackageDetailCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)DeliverToDcPackageDetail).CarrierName; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeliverToDcPackageDetailTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)DeliverToDcPackageDetail).TrackingId; } + + /// Delivery package shipping details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails DeliveryPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage = value ?? null /* model class */; } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageCarrierName; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeliveryPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingId; } + + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeliveryPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingUrl; } + + /// Holds device data erasure details + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails DeviceErasureDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail = value ?? null /* model class */; } + + /// Holds the device erasure completion status + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeviceErasureDetailDeviceErasureStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailDeviceErasureStatus; } + + /// Shared access key to download cleanup or destruction certificate for device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeviceErasureDetailErasureOrDestructionCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailErasureOrDestructionCertificateSasKey; } + + /// Shared access key to download secure erasure certificate for the device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeviceErasureDetailSecureErasureCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailSecureErasureCertificateSasKey; } + + /// Backing field for property. + private bool? _enableManifestBackup; + + /// Flag to indicate if disk manifest should be backed-up in the Storage Account. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? EnableManifestBackup { get => this._enableManifestBackup; set => this._enableManifestBackup = value; } + + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string EncryptionPreferenceDoubleEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceDoubleEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceDoubleEncryption = value ?? null; } + + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string EncryptionPreferenceHardwareEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceHardwareEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceHardwareEncryption = value ?? null; } + + /// + /// The expected size of the data, which needs to be transferred in this job, in terabytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public int? ExpectedDataSizeInTeraByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ExpectedDataSizeInTeraByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ExpectedDataSizeInTeraByte = value ?? default(int); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection _exportDiskDetailsCollection; + + /// Contains the map of disk serial number to the disk details for export jobs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection ExportDiskDetailsCollection { get => (this._exportDiskDetailsCollection = this._exportDiskDetailsCollection ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection()); } + + /// Managed service identity type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string IdentityPropertyType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyType = value ?? null; } + + /// User assigned identity properties. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties IdentityPropertyUserAssigned { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned = value ?? null /* model class */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection _importDiskDetailsCollection; + + /// Contains the map of disk serial number to the disk details for import jobs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection ImportDiskDetailsCollection { get => (this._importDiskDetailsCollection = this._importDiskDetailsCollection ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection()); set => this._importDiskDetailsCollection = value; } + + /// List of stages that run in the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List JobStage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).JobStage; } + + /// Details about which key encryption type is being used. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey KeyEncryptionKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey = value ?? null /* model class */; } + + /// Managed identity properties used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties KeyEncryptionKeyIdentityProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty = value ?? null /* model class */; } + + /// Type of encryption key used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string KeyEncryptionKeyKekType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekType = value ?? null; } + + /// Key encryption key. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string KeyEncryptionKeyKekUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekUrl = value ?? null; } + + /// Kek vault resource id. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string KeyEncryptionKeyKekVaultResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekVaultResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekVaultResourceId = value ?? null; } + + /// Last mitigation action performed on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob LastMitigationActionOnJob { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob = value ?? null /* model class */; } + + /// Action performed date time + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public global::System.DateTime? LastMitigationActionOnJobActionDateTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobActionDateTimeInUtc; } + + /// Resolution code provided by customer + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string LastMitigationActionOnJobCustomerResolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobCustomerResolution; } + + /// + /// Action performed by customer, + /// possibility is that mitigation might happen by customer or service or by ops + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? LastMitigationActionOnJobIsPerformedByCustomer { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobIsPerformedByCustomer; } + + /// Internal Acessors for CopyProgress + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal.CopyProgress { get => this._copyProgress; set { {_copyProgress = value;} } } + + /// Internal Acessors for DeliverToDcPackageDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal.DeliverToDcPackageDetail { get => (this._deliverToDcPackageDetail = this._deliverToDcPackageDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierInfo()); set { {_deliverToDcPackageDetail = value;} } } + + /// Internal Acessors for DeliverToDcPackageDetailCarrierName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal.DeliverToDcPackageDetailCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)DeliverToDcPackageDetail).CarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)DeliverToDcPackageDetail).CarrierName = value ?? null; } + + /// Internal Acessors for DeliverToDcPackageDetailTrackingId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal.DeliverToDcPackageDetailTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)DeliverToDcPackageDetail).TrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)DeliverToDcPackageDetail).TrackingId = value ?? null; } + + /// Internal Acessors for ExportDiskDetailsCollection + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal.ExportDiskDetailsCollection { get => (this._exportDiskDetailsCollection = this._exportDiskDetailsCollection ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection()); set { {_exportDiskDetailsCollection = value;} } } + + /// Internal Acessors for ReturnToCustomerPackageDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsInternal.ReturnToCustomerPackageDetail { get => (this._returnToCustomerPackageDetail = this._returnToCustomerPackageDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierDetails()); set { {_returnToCustomerPackageDetail = value;} } } + + /// Internal Acessors for Action + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Action; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Action = value ?? null /* arrayOf */; } + + /// Internal Acessors for ChainOfCustodySasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ChainOfCustodySasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ChainOfCustodySasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ChainOfCustodySasKey = value ?? null; } + + /// Internal Acessors for ContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail = value ?? null /* model class */; } + + /// Internal Acessors for CopyLogDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.CopyLogDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CopyLogDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CopyLogDetail = value ?? null /* arrayOf */; } + + /// Internal Acessors for DataCenterCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DataCenterCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataCenterCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataCenterCode = value ?? null; } + + /// Internal Acessors for DatacenterAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress = value ?? null /* model class */; } + + /// Internal Acessors for DatacenterAddressDataCenterAzureLocation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressDataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressDataCenterAzureLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressDataCenterAzureLocation = value ?? null; } + + /// Internal Acessors for DatacenterAddressSupportedCarriersForReturnShipment + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressSupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressSupportedCarriersForReturnShipment; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressSupportedCarriersForReturnShipment = value ?? null /* arrayOf */; } + + /// Internal Acessors for DatacenterAddressType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressType = value ?? null; } + + /// Internal Acessors for DeliveryPackage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage = value ?? null /* model class */; } + + /// Internal Acessors for DeliveryPackageCarrierName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageCarrierName = value ?? null; } + + /// Internal Acessors for DeliveryPackageTrackingId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingId = value ?? null; } + + /// Internal Acessors for DeliveryPackageTrackingUrl + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingUrl = value ?? null; } + + /// Internal Acessors for DeviceErasureDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail = value ?? null /* model class */; } + + /// Internal Acessors for DeviceErasureDetailDeviceErasureStatus + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailDeviceErasureStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailDeviceErasureStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailDeviceErasureStatus = value ?? null; } + + /// Internal Acessors for DeviceErasureDetailErasureOrDestructionCertificateSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailErasureOrDestructionCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailErasureOrDestructionCertificateSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailErasureOrDestructionCertificateSasKey = value ?? null; } + + /// Internal Acessors for DeviceErasureDetailSecureErasureCertificateSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailSecureErasureCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailSecureErasureCertificateSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailSecureErasureCertificateSasKey = value ?? null; } + + /// Internal Acessors for IdentityPropertyUserAssigned + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.IdentityPropertyUserAssigned { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned = value ?? null /* model class */; } + + /// Internal Acessors for JobStage + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.JobStage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).JobStage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).JobStage = value ?? null /* arrayOf */; } + + /// Internal Acessors for KeyEncryptionKey + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.KeyEncryptionKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey = value ?? null /* model class */; } + + /// Internal Acessors for KeyEncryptionKeyIdentityProperty + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.KeyEncryptionKeyIdentityProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty = value ?? null /* model class */; } + + /// Internal Acessors for LastMitigationActionOnJob + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJob { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob = value ?? null /* model class */; } + + /// Internal Acessors for LastMitigationActionOnJobActionDateTimeInUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobActionDateTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobActionDateTimeInUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobActionDateTimeInUtc = value ?? default(global::System.DateTime); } + + /// Internal Acessors for LastMitigationActionOnJobCustomerResolution + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobCustomerResolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobCustomerResolution; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobCustomerResolution = value ?? null; } + + /// Internal Acessors for LastMitigationActionOnJobIsPerformedByCustomer + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobIsPerformedByCustomer { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobIsPerformedByCustomer; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobIsPerformedByCustomer = value ?? default(bool); } + + /// Internal Acessors for Preference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.Preference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceEncryptionPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceEncryptionPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceReverseTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceReverseTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for ReturnPackage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage = value ?? null /* model class */; } + + /// Internal Acessors for ReturnPackageCarrierName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageCarrierName = value ?? null; } + + /// Internal Acessors for ReturnPackageTrackingId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingId = value ?? null; } + + /// Internal Acessors for ReturnPackageTrackingUrl + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingUrl = value ?? null; } + + /// Internal Acessors for ReverseShipmentLabelSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShipmentLabelSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShipmentLabelSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShipmentLabelSasKey = value ?? null; } + + /// Internal Acessors for ReverseShippingDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail = value ?? null /* model class */; } + + /// Internal Acessors for ReverseShippingDetailContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail = value ?? null /* model class */; } + + /// Internal Acessors for ReverseShippingDetailIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailIsUpdated = value ?? default(bool); } + + /// Internal Acessors for ReverseShippingDetailShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress = value ?? null /* model class */; } + + /// Internal Acessors for ReverseTransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferenceIsUpdated = value ?? default(bool); } + + /// Internal Acessors for ShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress = value ?? null /* model class */; } + + /// Internal Acessors for TransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferenceIsUpdated = value ?? default(bool); } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string PostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PostalCode = value ?? null; } + + /// Preferences for the order. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Preference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference = value ?? null /* model class */; } + + /// Preferences related to the Encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences PreferenceEncryptionPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference = value ?? null /* model class */; } + + /// Preferred data center region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List PreferencePreferredDataCenterRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferencePreferredDataCenterRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferencePreferredDataCenterRegion = value ?? null /* arrayOf */; } + + /// Optional Preferences related to the reverse shipment logistics of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceReverseTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference = value ?? null /* model class */; } + + /// Preferences related to the Access Tier of storage accounts. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceStorageAccountAccessTierPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceStorageAccountAccessTierPreference = value ?? null /* arrayOf */; } + + /// Preferences related to the shipment logistics of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference = value ?? null /* model class */; } + + /// Return package shipping details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails ReturnPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage = value ?? null /* model class */; } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageCarrierName; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReturnPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingId; } + + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReturnPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingUrl; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails _returnToCustomerPackageDetail; + + /// Return package shipping details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails ReturnToCustomerPackageDetail { get => (this._returnToCustomerPackageDetail = this._returnToCustomerPackageDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierDetails()); set => this._returnToCustomerPackageDetail = value; } + + /// Carrier Account Number of customer for customer disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Security.SecureString ReturnToCustomerPackageDetailCarrierAccountNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)ReturnToCustomerPackageDetail).CarrierAccountNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)ReturnToCustomerPackageDetail).CarrierAccountNumber = value ?? null; } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReturnToCustomerPackageDetailCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)ReturnToCustomerPackageDetail).CarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)ReturnToCustomerPackageDetail).CarrierName = value ?? null; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReturnToCustomerPackageDetailTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)ReturnToCustomerPackageDetail).TrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)ReturnToCustomerPackageDetail).TrackingId = value ?? null; } + + /// Shared access key to download the return shipment label + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShipmentLabelSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShipmentLabelSasKey; } + + /// Optional Reverse Shipping details for order. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails ReverseShippingDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail = value ?? null /* model class */; } + + /// Contact Info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo ReverseShippingDetailContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail = value ?? null /* model class */; } + + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? ReverseShippingDetailIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailIsUpdated; } + + /// Shipping address where customer wishes to receive the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ReverseShippingDetailShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress = value ?? null /* model class */; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactDetailsMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsMobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsMobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactDetailsPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhone = value ?? null; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactDetailsPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhoneExtension = value ?? null; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactName = value ?? null; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCity = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressCompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCompanyName = value ?? null; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressCountry { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCountry; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCountry = value ?? null; } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressPostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressPostalCode = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? ReverseShippingDetailsShippingAddressSkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressSkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressSkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressTaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressTaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = value ?? null; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressType = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressZipExtendedCode = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseTransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferencePreferredShipmentType = value ?? null; } + + /// Shipping address of the customer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress = value ?? null /* model class */; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddressType = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? SkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).SkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).SkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string TaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TaxIdentificationNumber = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string TransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferencePreferredShipmentType = value ?? null; } + + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => "DataBoxCustomerDisk"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Type = "DataBoxCustomerDisk"; } + + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string UserAssignedResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).UserAssignedResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).UserAssignedResourceId = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ZipExtendedCode = value ?? null; } + + /// Creates an new instance. + public DataBoxCustomerDiskJobDetails() + { + this.__jobDetails.Type = "DataBoxCustomerDisk"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobDetails), __jobDetails); + await eventListener.AssertObjectIsValid(nameof(__jobDetails), __jobDetails); + } + } + /// Customer disk job details. + public partial interface IDataBoxCustomerDiskJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails + { + /// Copy progress per disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Copy progress per disk.", + SerializedName = @"copyProgress", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskCopyProgress) })] + System.Collections.Generic.List CopyProgress { get; } + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the carrier.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string DeliverToDcPackageDetailCarrierName { get; } + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Tracking Id of shipment.", + SerializedName = @"trackingId", + PossibleTypes = new [] { typeof(string) })] + string DeliverToDcPackageDetailTrackingId { get; } + /// Flag to indicate if disk manifest should be backed-up in the Storage Account. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Flag to indicate if disk manifest should be backed-up in the Storage Account.", + SerializedName = @"enableManifestBackup", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableManifestBackup { get; set; } + /// Contains the map of disk serial number to the disk details for export jobs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Contains the map of disk serial number to the disk details for export jobs.", + SerializedName = @"exportDiskDetailsCollection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection ExportDiskDetailsCollection { get; } + /// Contains the map of disk serial number to the disk details for import jobs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Contains the map of disk serial number to the disk details for import jobs.", + SerializedName = @"importDiskDetailsCollection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection ImportDiskDetailsCollection { get; set; } + /// Carrier Account Number of customer for customer disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Carrier Account Number of customer for customer disk.", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(System.Security.SecureString) })] + System.Security.SecureString ReturnToCustomerPackageDetailCarrierAccountNumber { get; set; } + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the carrier.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string ReturnToCustomerPackageDetailCarrierName { get; set; } + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Tracking Id of shipment.", + SerializedName = @"trackingId", + PossibleTypes = new [] { typeof(string) })] + string ReturnToCustomerPackageDetailTrackingId { get; set; } + + } + /// Customer disk job details. + internal partial interface IDataBoxCustomerDiskJobDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal + { + /// Copy progress per disk. + System.Collections.Generic.List CopyProgress { get; set; } + /// Delivery package shipping details. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo DeliverToDcPackageDetail { get; set; } + /// Name of the carrier. + string DeliverToDcPackageDetailCarrierName { get; set; } + /// Tracking Id of shipment. + string DeliverToDcPackageDetailTrackingId { get; set; } + /// Flag to indicate if disk manifest should be backed-up in the Storage Account. + bool? EnableManifestBackup { get; set; } + /// Contains the map of disk serial number to the disk details for export jobs. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection ExportDiskDetailsCollection { get; set; } + /// Contains the map of disk serial number to the disk details for import jobs. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection ImportDiskDetailsCollection { get; set; } + /// Return package shipping details. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails ReturnToCustomerPackageDetail { get; set; } + /// Carrier Account Number of customer for customer disk. + System.Security.SecureString ReturnToCustomerPackageDetailCarrierAccountNumber { get; set; } + /// Name of the carrier. + string ReturnToCustomerPackageDetailCarrierName { get; set; } + /// Tracking Id of shipment. + string ReturnToCustomerPackageDetailTrackingId { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.json.cs new file mode 100644 index 00000000000..5acfcbc1b96 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetails.json.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Customer disk job details. + public partial class DataBoxCustomerDiskJobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxCustomerDiskJobDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetails(json); + {_deliverToDcPackageDetail = If( json?.PropertyT("deliverToDcPackageDetails"), out var __jsonDeliverToDcPackageDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierInfo.FromJson(__jsonDeliverToDcPackageDetails) : _deliverToDcPackageDetail;} + {_returnToCustomerPackageDetail = If( json?.PropertyT("returnToCustomerPackageDetails"), out var __jsonReturnToCustomerPackageDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierDetails.FromJson(__jsonReturnToCustomerPackageDetails) : _returnToCustomerPackageDetail;} + {_importDiskDetailsCollection = If( json?.PropertyT("importDiskDetailsCollection"), out var __jsonImportDiskDetailsCollection) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.FromJson(__jsonImportDiskDetailsCollection) : _importDiskDetailsCollection;} + {_exportDiskDetailsCollection = If( json?.PropertyT("exportDiskDetailsCollection"), out var __jsonExportDiskDetailsCollection) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.FromJson(__jsonExportDiskDetailsCollection) : _exportDiskDetailsCollection;} + {_copyProgress = If( json?.PropertyT("copyProgress"), out var __jsonCopyProgress) ? If( __jsonCopyProgress as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDataBoxCustomerDiskCopyProgress) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskCopyProgress.FromJson(__u) )) ))() : null : _copyProgress;} + {_enableManifestBackup = If( json?.PropertyT("enableManifestBackup"), out var __jsonEnableManifestBackup) ? (bool?)__jsonEnableManifestBackup : _enableManifestBackup;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxCustomerDiskJobDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._deliverToDcPackageDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._deliverToDcPackageDetail.ToJson(null,serializationMode) : null, "deliverToDcPackageDetails" ,container.Add ); + } + AddIf( null != this._returnToCustomerPackageDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._returnToCustomerPackageDetail.ToJson(null,serializationMode) : null, "returnToCustomerPackageDetails" ,container.Add ); + AddIf( null != this._importDiskDetailsCollection ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._importDiskDetailsCollection.ToJson(null,serializationMode) : null, "importDiskDetailsCollection" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._exportDiskDetailsCollection ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._exportDiskDetailsCollection.ToJson(null,serializationMode) : null, "exportDiskDetailsCollection" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._copyProgress) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._copyProgress ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("copyProgress",__w); + } + } + AddIf( null != this._enableManifestBackup ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._enableManifestBackup) : null, "enableManifestBackup" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.PowerShell.cs new file mode 100644 index 00000000000..4f8d219e120 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.PowerShell.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Contains the map of disk serial number to the disk details for export jobs. + [System.ComponentModel.TypeConverter(typeof(DataBoxCustomerDiskJobDetailsExportDiskDetailsCollectionTypeConverter))] + public partial class DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection + { + + /// + /// 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 DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + 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.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection(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.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection(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.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Contains the map of disk serial number to the disk details for export jobs. + [System.ComponentModel.TypeConverter(typeof(DataBoxCustomerDiskJobDetailsExportDiskDetailsCollectionTypeConverter))] + public partial interface IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.TypeConverter.cs new file mode 100644 index 00000000000..f17180d7fb4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxCustomerDiskJobDetailsExportDiskDetailsCollectionTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.cs new file mode 100644 index 00000000000..b65f7f53e01 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Contains the map of disk serial number to the disk details for export jobs. + public partial class DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollectionInternal + { + + /// + /// Creates an new instance. + /// + public DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection() + { + + } + } + /// Contains the map of disk serial number to the disk details for export jobs. + public partial interface IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + + } + /// Contains the map of disk serial number to the disk details for export jobs. + internal partial interface IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollectionInternal + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.dictionary.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.dictionary.cs new file mode 100644 index 00000000000..0a11d411803 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.dictionary.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetails this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetails value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetails value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.json.cs new file mode 100644 index 00000000000..9f31653796e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Contains the map of disk serial number to the disk details for export jobs. + public partial class DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + /// + internal DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, (j) => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ExportDiskDetails.FromJson(j) ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsExportDiskDetailsCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxCustomerDiskJobDetailsExportDiskDetailsCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.PowerShell.cs new file mode 100644 index 00000000000..430f7888217 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.PowerShell.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Contains the map of disk serial number to the disk details for import jobs. + [System.ComponentModel.TypeConverter(typeof(DataBoxCustomerDiskJobDetailsImportDiskDetailsCollectionTypeConverter))] + public partial class DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection + { + + /// + /// 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 DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + 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.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection(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.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection(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.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Contains the map of disk serial number to the disk details for import jobs. + [System.ComponentModel.TypeConverter(typeof(DataBoxCustomerDiskJobDetailsImportDiskDetailsCollectionTypeConverter))] + public partial interface IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.TypeConverter.cs new file mode 100644 index 00000000000..9cac3eacae0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxCustomerDiskJobDetailsImportDiskDetailsCollectionTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.cs new file mode 100644 index 00000000000..010a1dcad1d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Contains the map of disk serial number to the disk details for import jobs. + public partial class DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollectionInternal + { + + /// + /// Creates an new instance. + /// + public DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection() + { + + } + } + /// Contains the map of disk serial number to the disk details for import jobs. + public partial interface IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + + } + /// Contains the map of disk serial number to the disk details for import jobs. + internal partial interface IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollectionInternal + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.dictionary.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.dictionary.cs new file mode 100644 index 00000000000..84494cd6b35 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.dictionary.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetails this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetails value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetails value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.json.cs new file mode 100644 index 00000000000..db19c82eb27 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Contains the map of disk serial number to the disk details for import jobs. + public partial class DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + /// + internal DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, (j) => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ImportDiskDetails.FromJson(j) ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetailsImportDiskDetailsCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxCustomerDiskJobDetailsImportDiskDetailsCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.PowerShell.cs new file mode 100644 index 00000000000..6bbecb4ad7b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Copy Log Details for a disk + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskCopyLogDetailsTypeConverter))] + public partial class DataBoxDiskCopyLogDetails + { + + /// + /// 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 DataBoxDiskCopyLogDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskSerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal)this).DiskSerialNumber = (string) content.GetValueForProperty("DiskSerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal)this).DiskSerialNumber, global::System.Convert.ToString); + } + if (content.Contains("ErrorLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal)this).ErrorLogLink = (string) content.GetValueForProperty("ErrorLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal)this).ErrorLogLink, global::System.Convert.ToString); + } + if (content.Contains("VerboseLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal)this).VerboseLogLink = (string) content.GetValueForProperty("VerboseLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal)this).VerboseLogLink, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type, 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 DataBoxDiskCopyLogDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskSerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal)this).DiskSerialNumber = (string) content.GetValueForProperty("DiskSerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal)this).DiskSerialNumber, global::System.Convert.ToString); + } + if (content.Contains("ErrorLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal)this).ErrorLogLink = (string) content.GetValueForProperty("ErrorLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal)this).ErrorLogLink, global::System.Convert.ToString); + } + if (content.Contains("VerboseLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal)this).VerboseLogLink = (string) content.GetValueForProperty("VerboseLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal)this).VerboseLogLink, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type, 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.DataBox.Models.IDataBoxDiskCopyLogDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxDiskCopyLogDetails(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.DataBox.Models.IDataBoxDiskCopyLogDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxDiskCopyLogDetails(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.DataBox.Models.IDataBoxDiskCopyLogDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Copy Log Details for a disk + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskCopyLogDetailsTypeConverter))] + public partial interface IDataBoxDiskCopyLogDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.TypeConverter.cs new file mode 100644 index 00000000000..b824f3be244 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxDiskCopyLogDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxDiskCopyLogDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxDiskCopyLogDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxDiskCopyLogDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.cs new file mode 100644 index 00000000000..d69deda6290 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Copy Log Details for a disk + public partial class DataBoxDiskCopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails __copyLogDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetails(); + + /// Backing field for property. + private string _diskSerialNumber; + + /// Disk Serial Number. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DiskSerialNumber { get => this._diskSerialNumber; } + + /// Backing field for property. + private string _errorLogLink; + + /// Link for copy error logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ErrorLogLink { get => this._errorLogLink; } + + /// Internal Acessors for DiskSerialNumber + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal.DiskSerialNumber { get => this._diskSerialNumber; set { {_diskSerialNumber = value;} } } + + /// Internal Acessors for ErrorLogLink + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal.ErrorLogLink { get => this._errorLogLink; set { {_errorLogLink = value;} } } + + /// Internal Acessors for VerboseLogLink + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetailsInternal.VerboseLogLink { get => this._verboseLogLink; set { {_verboseLogLink = value;} } } + + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => "DataBoxDisk"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)__copyLogDetails).Type = "DataBoxDisk"; } + + /// Backing field for property. + private string _verboseLogLink; + + /// Link for copy verbose logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string VerboseLogLink { get => this._verboseLogLink; } + + /// Creates an new instance. + public DataBoxDiskCopyLogDetails() + { + this.__copyLogDetails.Type = "DataBoxDisk"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__copyLogDetails), __copyLogDetails); + await eventListener.AssertObjectIsValid(nameof(__copyLogDetails), __copyLogDetails); + } + } + /// Copy Log Details for a disk + public partial interface IDataBoxDiskCopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails + { + /// Disk Serial Number. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Disk Serial Number.", + SerializedName = @"diskSerialNumber", + PossibleTypes = new [] { typeof(string) })] + string DiskSerialNumber { get; } + /// Link for copy error logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Link for copy error logs.", + SerializedName = @"errorLogLink", + PossibleTypes = new [] { typeof(string) })] + string ErrorLogLink { get; } + /// Link for copy verbose logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Link for copy verbose logs.", + SerializedName = @"verboseLogLink", + PossibleTypes = new [] { typeof(string) })] + string VerboseLogLink { get; } + + } + /// Copy Log Details for a disk + internal partial interface IDataBoxDiskCopyLogDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal + { + /// Disk Serial Number. + string DiskSerialNumber { get; set; } + /// Link for copy error logs. + string ErrorLogLink { get; set; } + /// Link for copy verbose logs. + string VerboseLogLink { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.json.cs new file mode 100644 index 00000000000..14169feeebf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyLogDetails.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Copy Log Details for a disk + public partial class DataBoxDiskCopyLogDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxDiskCopyLogDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __copyLogDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetails(json); + {_diskSerialNumber = If( json?.PropertyT("diskSerialNumber"), out var __jsonDiskSerialNumber) ? (string)__jsonDiskSerialNumber : (string)_diskSerialNumber;} + {_errorLogLink = If( json?.PropertyT("errorLogLink"), out var __jsonErrorLogLink) ? (string)__jsonErrorLogLink : (string)_errorLogLink;} + {_verboseLogLink = If( json?.PropertyT("verboseLogLink"), out var __jsonVerboseLogLink) ? (string)__jsonVerboseLogLink : (string)_verboseLogLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyLogDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxDiskCopyLogDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __copyLogDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._diskSerialNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._diskSerialNumber.ToString()) : null, "diskSerialNumber" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._errorLogLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._errorLogLink.ToString()) : null, "errorLogLink" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._verboseLogLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._verboseLogLink.ToString()) : null, "verboseLogLink" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.PowerShell.cs new file mode 100644 index 00000000000..4fb1b5f0b09 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.PowerShell.cs @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// DataBox Disk Copy Progress + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskCopyProgressTypeConverter))] + public partial class DataBoxDiskCopyProgress + { + + /// + /// 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 DataBoxDiskCopyProgress(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("SerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).SerialNumber = (string) content.GetValueForProperty("SerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).SerialNumber, global::System.Convert.ToString); + } + if (content.Contains("BytesCopied")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).BytesCopied = (long?) content.GetValueForProperty("BytesCopied",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).BytesCopied, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PercentComplete")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).PercentComplete = (int?) content.GetValueForProperty("PercentComplete",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).PercentComplete, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Target, 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 DataBoxDiskCopyProgress(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("SerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).SerialNumber = (string) content.GetValueForProperty("SerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).SerialNumber, global::System.Convert.ToString); + } + if (content.Contains("BytesCopied")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).BytesCopied = (long?) content.GetValueForProperty("BytesCopied",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).BytesCopied, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PercentComplete")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).PercentComplete = (int?) content.GetValueForProperty("PercentComplete",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).PercentComplete, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal)this).Target, 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.DataBox.Models.IDataBoxDiskCopyProgress DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxDiskCopyProgress(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.DataBox.Models.IDataBoxDiskCopyProgress DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxDiskCopyProgress(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.DataBox.Models.IDataBoxDiskCopyProgress FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// DataBox Disk Copy Progress + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskCopyProgressTypeConverter))] + public partial interface IDataBoxDiskCopyProgress + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.TypeConverter.cs new file mode 100644 index 00000000000..90a4ad9fd02 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxDiskCopyProgressTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgress ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgress).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxDiskCopyProgress.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxDiskCopyProgress.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxDiskCopyProgress.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.cs new file mode 100644 index 00000000000..1416bfb343d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.cs @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// DataBox Disk Copy Progress + public partial class DataBoxDiskCopyProgress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgress, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _action; + + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List Action { get => this._action; } + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo; } + + /// Backing field for property. + private long? _bytesCopied; + + /// Bytes copied during the copy of disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? BytesCopied { get => this._bytesCopied; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError _error; + + /// Error, if any, in the stage + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError()); } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message; } + + /// Internal Acessors for Action + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal.Action { get => this._action; set { {_action = value;} } } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for BytesCopied + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal.BytesCopied { get => this._bytesCopied; set { {_bytesCopied = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError()); set { {_error = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message = value ?? null; } + + /// Internal Acessors for PercentComplete + int? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal.PercentComplete { get => this._percentComplete; set { {_percentComplete = value;} } } + + /// Internal Acessors for SerialNumber + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal.SerialNumber { get => this._serialNumber; set { {_serialNumber = value;} } } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal.Status { get => this._status; set { {_status = value;} } } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgressInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target = value ?? null; } + + /// Backing field for property. + private int? _percentComplete; + + /// Indicates the percentage completed for the copy of the disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public int? PercentComplete { get => this._percentComplete; } + + /// Backing field for property. + private string _serialNumber; + + /// The serial number of the disk + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string SerialNumber { get => this._serialNumber; } + + /// Backing field for property. + private string _status; + + /// The Status of the copy + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Status { get => this._status; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target; } + + /// Creates an new instance. + public DataBoxDiskCopyProgress() + { + + } + } + /// DataBox Disk Copy Progress + public partial interface IDataBoxDiskCopyProgress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Available actions on the job.", + SerializedName = @"actions", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + System.Collections.Generic.List Action { get; } + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets additional error info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// Bytes copied during the copy of disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Bytes copied during the copy of disk.", + SerializedName = @"bytesCopied", + PossibleTypes = new [] { typeof(long) })] + long? BytesCopied { get; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets details for the error.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) })] + System.Collections.Generic.List Detail { get; } + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message parsed from the body of the http error response.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// Indicates the percentage completed for the copy of the disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Indicates the percentage completed for the copy of the disk.", + SerializedName = @"percentComplete", + PossibleTypes = new [] { typeof(int) })] + int? PercentComplete { get; } + /// The serial number of the disk + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The serial number of the disk", + SerializedName = @"serialNumber", + PossibleTypes = new [] { typeof(string) })] + string SerialNumber { get; } + /// The Status of the copy + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The Status of the copy", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("NotStarted", "InProgress", "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", "DriveNotDetected", "DriveCorrupted", "MetadataFilesModifiedOrRemoved")] + string Status { get; } + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the target of the error.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// DataBox Disk Copy Progress + internal partial interface IDataBoxDiskCopyProgressInternal + + { + /// Available actions on the job. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + System.Collections.Generic.List Action { get; set; } + /// Gets or sets additional error info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// Bytes copied during the copy of disk. + long? BytesCopied { get; set; } + /// Error code. + string Code { get; set; } + /// Gets or sets details for the error. + System.Collections.Generic.List Detail { get; set; } + /// Error, if any, in the stage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get; set; } + /// The error message parsed from the body of the http error response. + string Message { get; set; } + /// Indicates the percentage completed for the copy of the disk. + int? PercentComplete { get; set; } + /// The serial number of the disk + string SerialNumber { get; set; } + /// The Status of the copy + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("NotStarted", "InProgress", "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", "DriveNotDetected", "DriveCorrupted", "MetadataFilesModifiedOrRemoved")] + string Status { get; set; } + /// Gets or sets the target of the error. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.json.cs new file mode 100644 index 00000000000..b093ca2e700 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskCopyProgress.json.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// DataBox Disk Copy Progress + public partial class DataBoxDiskCopyProgress + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxDiskCopyProgress(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError.FromJson(__jsonError) : _error;} + {_serialNumber = If( json?.PropertyT("serialNumber"), out var __jsonSerialNumber) ? (string)__jsonSerialNumber : (string)_serialNumber;} + {_bytesCopied = If( json?.PropertyT("bytesCopied"), out var __jsonBytesCopied) ? (long?)__jsonBytesCopied : _bytesCopied;} + {_percentComplete = If( json?.PropertyT("percentComplete"), out var __jsonPercentComplete) ? (int?)__jsonPercentComplete : _percentComplete;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} + {_action = If( json?.PropertyT("actions"), out var __jsonActions) ? If( __jsonActions as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _action;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgress. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgress. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgress FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxDiskCopyProgress(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._serialNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._serialNumber.ToString()) : null, "serialNumber" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._bytesCopied ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._bytesCopied) : null, "bytesCopied" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._percentComplete ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((int)this._percentComplete) : null, "percentComplete" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._action) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._action ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("actions",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.PowerShell.cs new file mode 100644 index 00000000000..5b2fa4ef725 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Granular Copy Log Details for customer disk + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskGranularCopyLogDetailsTypeConverter))] + public partial class DataBoxDiskGranularCopyLogDetails + { + + /// + /// 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 DataBoxDiskGranularCopyLogDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).SerialNumber = (string) content.GetValueForProperty("SerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).SerialNumber, global::System.Convert.ToString); + } + if (content.Contains("AccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).AccountId = (string) content.GetValueForProperty("AccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).AccountId, global::System.Convert.ToString); + } + if (content.Contains("ErrorLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).ErrorLogLink = (string) content.GetValueForProperty("ErrorLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).ErrorLogLink, global::System.Convert.ToString); + } + if (content.Contains("VerboseLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).VerboseLogLink = (string) content.GetValueForProperty("VerboseLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).VerboseLogLink, global::System.Convert.ToString); + } + if (content.Contains("CopyLogDetailsType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetailsInternal)this).CopyLogDetailsType = (string) content.GetValueForProperty("CopyLogDetailsType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetailsInternal)this).CopyLogDetailsType, 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 DataBoxDiskGranularCopyLogDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).SerialNumber = (string) content.GetValueForProperty("SerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).SerialNumber, global::System.Convert.ToString); + } + if (content.Contains("AccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).AccountId = (string) content.GetValueForProperty("AccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).AccountId, global::System.Convert.ToString); + } + if (content.Contains("ErrorLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).ErrorLogLink = (string) content.GetValueForProperty("ErrorLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).ErrorLogLink, global::System.Convert.ToString); + } + if (content.Contains("VerboseLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).VerboseLogLink = (string) content.GetValueForProperty("VerboseLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal)this).VerboseLogLink, global::System.Convert.ToString); + } + if (content.Contains("CopyLogDetailsType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetailsInternal)this).CopyLogDetailsType = (string) content.GetValueForProperty("CopyLogDetailsType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetailsInternal)this).CopyLogDetailsType, 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.DataBox.Models.IDataBoxDiskGranularCopyLogDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxDiskGranularCopyLogDetails(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.DataBox.Models.IDataBoxDiskGranularCopyLogDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxDiskGranularCopyLogDetails(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.DataBox.Models.IDataBoxDiskGranularCopyLogDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Granular Copy Log Details for customer disk + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskGranularCopyLogDetailsTypeConverter))] + public partial interface IDataBoxDiskGranularCopyLogDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.TypeConverter.cs new file mode 100644 index 00000000000..1ee3755fb9b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxDiskGranularCopyLogDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxDiskGranularCopyLogDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxDiskGranularCopyLogDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxDiskGranularCopyLogDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.cs new file mode 100644 index 00000000000..4bb727e957d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Granular Copy Log Details for customer disk + public partial class DataBoxDiskGranularCopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetails __granularCopyLogDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.GranularCopyLogDetails(); + + /// Backing field for property. + private string _accountId; + + /// Account id. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string AccountId { get => this._accountId; } + + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string CopyLogDetailsType { get => "DataBoxCustomerDisk"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetailsInternal)__granularCopyLogDetails).CopyLogDetailsType = "DataBoxCustomerDisk"; } + + /// Backing field for property. + private string _errorLogLink; + + /// Link for copy error logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ErrorLogLink { get => this._errorLogLink; } + + /// Internal Acessors for AccountId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal.AccountId { get => this._accountId; set { {_accountId = value;} } } + + /// Internal Acessors for ErrorLogLink + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal.ErrorLogLink { get => this._errorLogLink; set { {_errorLogLink = value;} } } + + /// Internal Acessors for SerialNumber + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal.SerialNumber { get => this._serialNumber; set { {_serialNumber = value;} } } + + /// Internal Acessors for VerboseLogLink + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetailsInternal.VerboseLogLink { get => this._verboseLogLink; set { {_verboseLogLink = value;} } } + + /// Backing field for property. + private string _serialNumber; + + /// Disk Serial Number. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string SerialNumber { get => this._serialNumber; } + + /// Backing field for property. + private string _verboseLogLink; + + /// Link for copy verbose logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string VerboseLogLink { get => this._verboseLogLink; } + + /// Creates an new instance. + public DataBoxDiskGranularCopyLogDetails() + { + this.__granularCopyLogDetails.CopyLogDetailsType = "DataBoxCustomerDisk"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__granularCopyLogDetails), __granularCopyLogDetails); + await eventListener.AssertObjectIsValid(nameof(__granularCopyLogDetails), __granularCopyLogDetails); + } + } + /// Granular Copy Log Details for customer disk + public partial interface IDataBoxDiskGranularCopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetails + { + /// Account id. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Account id.", + SerializedName = @"accountId", + PossibleTypes = new [] { typeof(string) })] + string AccountId { get; } + /// Link for copy error logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Link for copy error logs.", + SerializedName = @"errorLogLink", + PossibleTypes = new [] { typeof(string) })] + string ErrorLogLink { get; } + /// Disk Serial Number. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Disk Serial Number.", + SerializedName = @"serialNumber", + PossibleTypes = new [] { typeof(string) })] + string SerialNumber { get; } + /// Link for copy verbose logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Link for copy verbose logs.", + SerializedName = @"verboseLogLink", + PossibleTypes = new [] { typeof(string) })] + string VerboseLogLink { get; } + + } + /// Granular Copy Log Details for customer disk + internal partial interface IDataBoxDiskGranularCopyLogDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetailsInternal + { + /// Account id. + string AccountId { get; set; } + /// Link for copy error logs. + string ErrorLogLink { get; set; } + /// Disk Serial Number. + string SerialNumber { get; set; } + /// Link for copy verbose logs. + string VerboseLogLink { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.json.cs new file mode 100644 index 00000000000..a88003e27ab --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyLogDetails.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Granular Copy Log Details for customer disk + public partial class DataBoxDiskGranularCopyLogDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxDiskGranularCopyLogDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __granularCopyLogDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.GranularCopyLogDetails(json); + {_serialNumber = If( json?.PropertyT("serialNumber"), out var __jsonSerialNumber) ? (string)__jsonSerialNumber : (string)_serialNumber;} + {_accountId = If( json?.PropertyT("accountId"), out var __jsonAccountId) ? (string)__jsonAccountId : (string)_accountId;} + {_errorLogLink = If( json?.PropertyT("errorLogLink"), out var __jsonErrorLogLink) ? (string)__jsonErrorLogLink : (string)_errorLogLink;} + {_verboseLogLink = If( json?.PropertyT("verboseLogLink"), out var __jsonVerboseLogLink) ? (string)__jsonVerboseLogLink : (string)_verboseLogLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxDiskGranularCopyLogDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __granularCopyLogDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._serialNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._serialNumber.ToString()) : null, "serialNumber" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._accountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._accountId.ToString()) : null, "accountId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._errorLogLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._errorLogLink.ToString()) : null, "errorLogLink" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._verboseLogLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._verboseLogLink.ToString()) : null, "verboseLogLink" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.PowerShell.cs new file mode 100644 index 00000000000..2442f39a2ef --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.PowerShell.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// DataBox Disk Granular Copy Progress + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskGranularCopyProgressTypeConverter))] + public partial class DataBoxDiskGranularCopyProgress + { + + /// + /// 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 DataBoxDiskGranularCopyProgress(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgressInternal)this).SerialNumber = (string) content.GetValueForProperty("SerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgressInternal)this).SerialNumber, global::System.Convert.ToString); + } + if (content.Contains("CopyStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgressInternal)this).CopyStatus = (string) content.GetValueForProperty("CopyStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgressInternal)this).CopyStatus, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("StorageAccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).StorageAccountName = (string) content.GetValueForProperty("StorageAccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).StorageAccountName, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AccountId = (string) content.GetValueForProperty("AccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AccountId, global::System.Convert.ToString); + } + if (content.Contains("BytesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).BytesProcessed = (long?) content.GetValueForProperty("BytesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).BytesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBytesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalBytesToProcess = (long?) content.GetValueForProperty("TotalBytesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalBytesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesProcessed = (long?) content.GetValueForProperty("FilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalFilesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalFilesToProcess = (long?) content.GetValueForProperty("TotalFilesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalFilesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFilesProcessed = (long?) content.GetValueForProperty("InvalidFilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFileBytesUploaded")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFileBytesUploaded = (long?) content.GetValueForProperty("InvalidFileBytesUploaded",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFileBytesUploaded, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RenamedContainerCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).RenamedContainerCount = (long?) content.GetValueForProperty("RenamedContainerCount",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).RenamedContainerCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesErroredOut = (long?) content.GetValueForProperty("FilesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DirectoriesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DirectoriesErroredOut = (long?) content.GetValueForProperty("DirectoriesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DirectoriesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidDirectoriesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidDirectoriesProcessed = (long?) content.GetValueForProperty("InvalidDirectoriesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidDirectoriesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IsEnumerationInProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).IsEnumerationInProgress = (bool?) content.GetValueForProperty("IsEnumerationInProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).IsEnumerationInProgress, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, 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 DataBoxDiskGranularCopyProgress(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgressInternal)this).SerialNumber = (string) content.GetValueForProperty("SerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgressInternal)this).SerialNumber, global::System.Convert.ToString); + } + if (content.Contains("CopyStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgressInternal)this).CopyStatus = (string) content.GetValueForProperty("CopyStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgressInternal)this).CopyStatus, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("StorageAccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).StorageAccountName = (string) content.GetValueForProperty("StorageAccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).StorageAccountName, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AccountId = (string) content.GetValueForProperty("AccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AccountId, global::System.Convert.ToString); + } + if (content.Contains("BytesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).BytesProcessed = (long?) content.GetValueForProperty("BytesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).BytesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBytesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalBytesToProcess = (long?) content.GetValueForProperty("TotalBytesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalBytesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesProcessed = (long?) content.GetValueForProperty("FilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalFilesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalFilesToProcess = (long?) content.GetValueForProperty("TotalFilesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalFilesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFilesProcessed = (long?) content.GetValueForProperty("InvalidFilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFileBytesUploaded")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFileBytesUploaded = (long?) content.GetValueForProperty("InvalidFileBytesUploaded",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFileBytesUploaded, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RenamedContainerCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).RenamedContainerCount = (long?) content.GetValueForProperty("RenamedContainerCount",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).RenamedContainerCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesErroredOut = (long?) content.GetValueForProperty("FilesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DirectoriesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DirectoriesErroredOut = (long?) content.GetValueForProperty("DirectoriesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DirectoriesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidDirectoriesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidDirectoriesProcessed = (long?) content.GetValueForProperty("InvalidDirectoriesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidDirectoriesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IsEnumerationInProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).IsEnumerationInProgress = (bool?) content.GetValueForProperty("IsEnumerationInProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).IsEnumerationInProgress, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, 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.DataBox.Models.IDataBoxDiskGranularCopyProgress DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxDiskGranularCopyProgress(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.DataBox.Models.IDataBoxDiskGranularCopyProgress DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxDiskGranularCopyProgress(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.DataBox.Models.IDataBoxDiskGranularCopyProgress FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// DataBox Disk Granular Copy Progress + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskGranularCopyProgressTypeConverter))] + public partial interface IDataBoxDiskGranularCopyProgress + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.TypeConverter.cs new file mode 100644 index 00000000000..52ebf0ae674 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxDiskGranularCopyProgressTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgress ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgress).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxDiskGranularCopyProgress.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxDiskGranularCopyProgress.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxDiskGranularCopyProgress.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.cs new file mode 100644 index 00000000000..39e61df027b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.cs @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// DataBox Disk Granular Copy Progress + public partial class DataBoxDiskGranularCopyProgress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgress, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgressInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgress __granularCopyProgress = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.GranularCopyProgress(); + + /// Id of the account where the data needs to be uploaded. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string AccountId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).AccountId; } + + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Action; } + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).AdditionalInfo; } + + /// To indicate bytes transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? BytesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).BytesProcessed; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Code; } + + /// Backing field for property. + private string _copyStatus; + + /// The Status of the copy + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CopyStatus { get => this._copyStatus; } + + /// Data Account Type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DataAccountType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).DataAccountType; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Detail; } + + /// To indicate directories errored out in the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? DirectoriesErroredOut { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).DirectoriesErroredOut; } + + /// Error, if any, in the stage + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Error = value ?? null /* model class */; } + + /// Number of files which could not be copied + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? FilesErroredOut { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).FilesErroredOut; } + + /// Number of files processed + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? FilesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).FilesProcessed; } + + /// To indicate directories renamed + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? InvalidDirectoriesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).InvalidDirectoriesProcessed; } + + /// + /// Total amount of data not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? InvalidFileBytesUploaded { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).InvalidFileBytesUploaded; } + + /// + /// Number of files not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? InvalidFilesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).InvalidFilesProcessed; } + + /// + /// To indicate if enumeration of data is in progress. + /// Until this is true, the TotalBytesToProcess may not be valid. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? IsEnumerationInProgress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).IsEnumerationInProgress; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Message; } + + /// Internal Acessors for CopyStatus + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgressInternal.CopyStatus { get => this._copyStatus; set { {_copyStatus = value;} } } + + /// Internal Acessors for SerialNumber + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgressInternal.SerialNumber { get => this._serialNumber; set { {_serialNumber = value;} } } + + /// Internal Acessors for AccountId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.AccountId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).AccountId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).AccountId = value ?? null; } + + /// Internal Acessors for Action + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Action; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Action = value ?? null /* arrayOf */; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for BytesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.BytesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).BytesProcessed; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).BytesProcessed = value ?? default(long); } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Code = value ?? null; } + + /// Internal Acessors for DataAccountType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.DataAccountType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).DataAccountType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).DataAccountType = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for DirectoriesErroredOut + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.DirectoriesErroredOut { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).DirectoriesErroredOut; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).DirectoriesErroredOut = value ?? default(long); } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Error = value ?? null /* model class */; } + + /// Internal Acessors for FilesErroredOut + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.FilesErroredOut { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).FilesErroredOut; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).FilesErroredOut = value ?? default(long); } + + /// Internal Acessors for FilesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.FilesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).FilesProcessed; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).FilesProcessed = value ?? default(long); } + + /// Internal Acessors for InvalidDirectoriesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.InvalidDirectoriesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).InvalidDirectoriesProcessed; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).InvalidDirectoriesProcessed = value ?? default(long); } + + /// Internal Acessors for InvalidFileBytesUploaded + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.InvalidFileBytesUploaded { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).InvalidFileBytesUploaded; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).InvalidFileBytesUploaded = value ?? default(long); } + + /// Internal Acessors for InvalidFilesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.InvalidFilesProcessed { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).InvalidFilesProcessed; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).InvalidFilesProcessed = value ?? default(long); } + + /// Internal Acessors for IsEnumerationInProgress + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.IsEnumerationInProgress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).IsEnumerationInProgress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).IsEnumerationInProgress = value ?? default(bool); } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Message = value ?? null; } + + /// Internal Acessors for RenamedContainerCount + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.RenamedContainerCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).RenamedContainerCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).RenamedContainerCount = value ?? default(long); } + + /// Internal Acessors for StorageAccountName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.StorageAccountName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).StorageAccountName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).StorageAccountName = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Target = value ?? null; } + + /// Internal Acessors for TotalBytesToProcess + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.TotalBytesToProcess { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).TotalBytesToProcess; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).TotalBytesToProcess = value ?? default(long); } + + /// Internal Acessors for TotalFilesToProcess + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.TotalFilesToProcess { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).TotalFilesToProcess; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).TotalFilesToProcess = value ?? default(long); } + + /// Internal Acessors for TransferType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.TransferType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).TransferType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).TransferType = value ?? null; } + + /// + /// Number of folders not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? RenamedContainerCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).RenamedContainerCount; } + + /// Backing field for property. + private string _serialNumber; + + /// Disk Serial Number. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string SerialNumber { get => this._serialNumber; } + + /// + /// Name of the storage account. This will be empty for data account types other than storage account. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StorageAccountName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).StorageAccountName; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).Target; } + + /// Total amount of data to be processed by the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? TotalBytesToProcess { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).TotalBytesToProcess; } + + /// Total files to process + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public long? TotalFilesToProcess { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).TotalFilesToProcess; } + + /// Transfer type of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string TransferType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)__granularCopyProgress).TransferType; } + + /// Creates an new instance. + public DataBoxDiskGranularCopyProgress() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__granularCopyProgress), __granularCopyProgress); + await eventListener.AssertObjectIsValid(nameof(__granularCopyProgress), __granularCopyProgress); + } + } + /// DataBox Disk Granular Copy Progress + public partial interface IDataBoxDiskGranularCopyProgress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgress + { + /// The Status of the copy + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The Status of the copy", + SerializedName = @"copyStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("NotStarted", "InProgress", "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", "DriveNotDetected", "DriveCorrupted", "MetadataFilesModifiedOrRemoved")] + string CopyStatus { get; } + /// Disk Serial Number. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Disk Serial Number.", + SerializedName = @"serialNumber", + PossibleTypes = new [] { typeof(string) })] + string SerialNumber { get; } + + } + /// DataBox Disk Granular Copy Progress + internal partial interface IDataBoxDiskGranularCopyProgressInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal + { + /// The Status of the copy + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("NotStarted", "InProgress", "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", "DriveNotDetected", "DriveCorrupted", "MetadataFilesModifiedOrRemoved")] + string CopyStatus { get; set; } + /// Disk Serial Number. + string SerialNumber { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.json.cs new file mode 100644 index 00000000000..a718018f57c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskGranularCopyProgress.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// DataBox Disk Granular Copy Progress + public partial class DataBoxDiskGranularCopyProgress + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxDiskGranularCopyProgress(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __granularCopyProgress = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.GranularCopyProgress(json); + {_serialNumber = If( json?.PropertyT("serialNumber"), out var __jsonSerialNumber) ? (string)__jsonSerialNumber : (string)_serialNumber;} + {_copyStatus = If( json?.PropertyT("copyStatus"), out var __jsonCopyStatus) ? (string)__jsonCopyStatus : (string)_copyStatus;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgress. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgress. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgress FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxDiskGranularCopyProgress(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __granularCopyProgress?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._serialNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._serialNumber.ToString()) : null, "serialNumber" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._copyStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._copyStatus.ToString()) : null, "copyStatus" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.PowerShell.cs new file mode 100644 index 00000000000..b0f5a353795 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.PowerShell.cs @@ -0,0 +1,922 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// DataBox Disk Job Details. + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskJobDetailsTypeConverter))] + public partial class DataBoxDiskJobDetails + { + + /// + /// 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 DataBoxDiskJobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PreferredDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).PreferredDisk = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks) content.GetValueForProperty("PreferredDisk",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).PreferredDisk, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskJobDetailsPreferredDisksTypeConverter.ConvertFrom); + } + if (content.Contains("CopyProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).CopyProgress = (System.Collections.Generic.List) content.GetValueForProperty("CopyProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).CopyProgress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskCopyProgressTypeConverter.ConvertFrom)); + } + if (content.Contains("GranularCopyProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).GranularCopyProgress = (System.Collections.Generic.List) content.GetValueForProperty("GranularCopyProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).GranularCopyProgress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskGranularCopyProgressTypeConverter.ConvertFrom)); + } + if (content.Contains("GranularCopyLogDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).GranularCopyLogDetail = (System.Collections.Generic.List) content.GetValueForProperty("GranularCopyLogDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).GranularCopyLogDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskGranularCopyLogDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DisksAndSizeDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).DisksAndSizeDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails) content.GetValueForProperty("DisksAndSizeDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).DisksAndSizeDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskJobDetailsDisksAndSizeDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Passkey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).Passkey = (string) content.GetValueForProperty("Passkey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).Passkey, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailEmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailEmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContactDetailNotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailNotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ReverseShippingDetailShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyIdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("KeyEncryptionKeyIdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyKekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType = (string) content.GetValueForProperty("KeyEncryptionKeyKekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName = (string) content.GetValueForProperty("ContactDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone = (string) content.GetValueForProperty("ContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension = (string) content.GetValueForProperty("ContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile = (string) content.GetValueForProperty("ContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl = (string) content.GetValueForProperty("DeliveryPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId = (string) content.GetValueForProperty("DeliveryPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl = (string) content.GetValueForProperty("ReturnPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId = (string) content.GetValueForProperty("ReturnPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ReverseShippingDetailContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated = (bool?) content.GetValueForProperty("ReverseShippingDetailIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailDeviceErasureStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus = (string) content.GetValueForProperty("DeviceErasureDetailDeviceErasureStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailErasureOrDestructionCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailErasureOrDestructionCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailSecureErasureCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailSecureErasureCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl = (string) content.GetValueForProperty("KeyEncryptionKeyKekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId = (string) content.GetValueForProperty("KeyEncryptionKeyKekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("LastMitigationActionOnJobActionDateTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastMitigationActionOnJobActionDateTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMitigationActionOnJobIsPerformedByCustomer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer = (bool?) content.GetValueForProperty("LastMitigationActionOnJobIsPerformedByCustomer",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastMitigationActionOnJobCustomerResolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution = (string) content.GetValueForProperty("LastMitigationActionOnJobCustomerResolution",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressSupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("DatacenterAddressSupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DatacenterAddressDataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation = (string) content.GetValueForProperty("DatacenterAddressDataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName = (string) content.GetValueForProperty("ReverseShippingDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ReverseShippingDetailsShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId, global::System.Convert.ToString); + } + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails) content.GetValueForProperty("ReverseShippingDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceErasureDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails) content.GetValueForProperty("DeviceErasureDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey) content.GetValueForProperty("KeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKeyTypeConverter.ConvertFrom); + } + if (content.Contains("LastMitigationActionOnJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob) content.GetValueForProperty("LastMitigationActionOnJob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJobTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse) content.GetValueForProperty("DatacenterAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponseTypeConverter.ConvertFrom); + } + if (content.Contains("JobStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage = (System.Collections.Generic.List) content.GetValueForProperty("JobStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobStagesTypeConverter.ConvertFrom)); + } + if (content.Contains("DataImportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataImportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DataExportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataExportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CopyLogDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail = (System.Collections.Generic.List) content.GetValueForProperty("CopyLogDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReverseShipmentLabelSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey = (string) content.GetValueForProperty("ReverseShipmentLabelSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey, global::System.Convert.ToString); + } + if (content.Contains("ChainOfCustodySasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey = (string) content.GetValueForProperty("ChainOfCustodySasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey, global::System.Convert.ToString); + } + if (content.Contains("ExpectedDataSizeInTeraByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte = (int?) content.GetValueForProperty("ExpectedDataSizeInTeraByte",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode = (string) content.GetValueForProperty("DataCenterCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode, 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 DataBoxDiskJobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PreferredDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).PreferredDisk = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks) content.GetValueForProperty("PreferredDisk",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).PreferredDisk, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskJobDetailsPreferredDisksTypeConverter.ConvertFrom); + } + if (content.Contains("CopyProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).CopyProgress = (System.Collections.Generic.List) content.GetValueForProperty("CopyProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).CopyProgress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskCopyProgressTypeConverter.ConvertFrom)); + } + if (content.Contains("GranularCopyProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).GranularCopyProgress = (System.Collections.Generic.List) content.GetValueForProperty("GranularCopyProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).GranularCopyProgress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskGranularCopyProgressTypeConverter.ConvertFrom)); + } + if (content.Contains("GranularCopyLogDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).GranularCopyLogDetail = (System.Collections.Generic.List) content.GetValueForProperty("GranularCopyLogDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).GranularCopyLogDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskGranularCopyLogDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DisksAndSizeDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).DisksAndSizeDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails) content.GetValueForProperty("DisksAndSizeDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).DisksAndSizeDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskJobDetailsDisksAndSizeDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Passkey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).Passkey = (string) content.GetValueForProperty("Passkey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal)this).Passkey, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailEmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailEmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContactDetailNotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailNotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ReverseShippingDetailShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyIdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("KeyEncryptionKeyIdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyKekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType = (string) content.GetValueForProperty("KeyEncryptionKeyKekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName = (string) content.GetValueForProperty("ContactDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone = (string) content.GetValueForProperty("ContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension = (string) content.GetValueForProperty("ContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile = (string) content.GetValueForProperty("ContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl = (string) content.GetValueForProperty("DeliveryPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId = (string) content.GetValueForProperty("DeliveryPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl = (string) content.GetValueForProperty("ReturnPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId = (string) content.GetValueForProperty("ReturnPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ReverseShippingDetailContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated = (bool?) content.GetValueForProperty("ReverseShippingDetailIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailDeviceErasureStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus = (string) content.GetValueForProperty("DeviceErasureDetailDeviceErasureStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailErasureOrDestructionCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailErasureOrDestructionCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailSecureErasureCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailSecureErasureCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl = (string) content.GetValueForProperty("KeyEncryptionKeyKekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId = (string) content.GetValueForProperty("KeyEncryptionKeyKekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("LastMitigationActionOnJobActionDateTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastMitigationActionOnJobActionDateTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMitigationActionOnJobIsPerformedByCustomer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer = (bool?) content.GetValueForProperty("LastMitigationActionOnJobIsPerformedByCustomer",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastMitigationActionOnJobCustomerResolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution = (string) content.GetValueForProperty("LastMitigationActionOnJobCustomerResolution",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressSupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("DatacenterAddressSupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DatacenterAddressDataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation = (string) content.GetValueForProperty("DatacenterAddressDataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName = (string) content.GetValueForProperty("ReverseShippingDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ReverseShippingDetailsShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId, global::System.Convert.ToString); + } + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails) content.GetValueForProperty("ReverseShippingDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceErasureDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails) content.GetValueForProperty("DeviceErasureDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey) content.GetValueForProperty("KeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKeyTypeConverter.ConvertFrom); + } + if (content.Contains("LastMitigationActionOnJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob) content.GetValueForProperty("LastMitigationActionOnJob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJobTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse) content.GetValueForProperty("DatacenterAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponseTypeConverter.ConvertFrom); + } + if (content.Contains("JobStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage = (System.Collections.Generic.List) content.GetValueForProperty("JobStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobStagesTypeConverter.ConvertFrom)); + } + if (content.Contains("DataImportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataImportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DataExportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataExportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CopyLogDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail = (System.Collections.Generic.List) content.GetValueForProperty("CopyLogDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReverseShipmentLabelSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey = (string) content.GetValueForProperty("ReverseShipmentLabelSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey, global::System.Convert.ToString); + } + if (content.Contains("ChainOfCustodySasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey = (string) content.GetValueForProperty("ChainOfCustodySasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey, global::System.Convert.ToString); + } + if (content.Contains("ExpectedDataSizeInTeraByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte = (int?) content.GetValueForProperty("ExpectedDataSizeInTeraByte",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode = (string) content.GetValueForProperty("DataCenterCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode, 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.DataBox.Models.IDataBoxDiskJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxDiskJobDetails(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.DataBox.Models.IDataBoxDiskJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxDiskJobDetails(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.DataBox.Models.IDataBoxDiskJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// DataBox Disk Job Details. + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskJobDetailsTypeConverter))] + public partial interface IDataBoxDiskJobDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.TypeConverter.cs new file mode 100644 index 00000000000..302d2374b46 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxDiskJobDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxDiskJobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxDiskJobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxDiskJobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.cs new file mode 100644 index 00000000000..9bb774de03e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.cs @@ -0,0 +1,696 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// DataBox Disk Job Details. + public partial class DataBoxDiskJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetails(); + + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Action; } + + /// Shared access key to download the chain of custody logs + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ChainOfCustodySasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ChainOfCustodySasKey; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string City { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).City = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string CompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CompanyName = value ?? null; } + + /// Contact details for notification and shipping. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails ContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail = value ?? null /* model class */; } + + /// List of Email-ids to be notified about job progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List ContactDetailEmailList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailEmailList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailEmailList = value ; } + + /// Notification preference for a job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List ContactDetailNotificationPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailNotificationPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailNotificationPreference = value ?? null /* arrayOf */; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsContactName = value ; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsMobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsMobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhone = value ; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhoneExtension = value ?? null; } + + /// List of copy log details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List CopyLogDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CopyLogDetail; } + + /// Backing field for property. + private System.Collections.Generic.List _copyProgress; + + /// Copy progress per disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List CopyProgress { get => this._copyProgress; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Country { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Country = value ?? null; } + + /// DataCenter code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DataCenterCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataCenterCode; } + + /// Details of the data to be exported from azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List DataExportDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataExportDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataExportDetail = value ?? null /* arrayOf */; } + + /// Details of the data to be imported into azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List DataImportDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataImportDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataImportDetail = value ?? null /* arrayOf */; } + + /// Datacenter address to ship to, for the given sku and storage location. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse DatacenterAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress = value ?? null /* model class */; } + + /// Azure Location where the Data Center serves primarily. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DatacenterAddressDataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressDataCenterAzureLocation; } + + /// List of supported carriers for return shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List DatacenterAddressSupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressSupportedCarriersForReturnShipment; } + + /// Data center address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DatacenterAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressType; } + + /// Delivery package shipping details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails DeliveryPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage = value ?? null /* model class */; } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageCarrierName; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeliveryPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingId; } + + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeliveryPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingUrl; } + + /// Holds device data erasure details + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails DeviceErasureDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail = value ?? null /* model class */; } + + /// Holds the device erasure completion status + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeviceErasureDetailDeviceErasureStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailDeviceErasureStatus; } + + /// Shared access key to download cleanup or destruction certificate for device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeviceErasureDetailErasureOrDestructionCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailErasureOrDestructionCertificateSasKey; } + + /// Shared access key to download secure erasure certificate for the device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeviceErasureDetailSecureErasureCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailSecureErasureCertificateSasKey; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails _disksAndSizeDetail; + + /// + /// Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped + /// to the customer. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails DisksAndSizeDetail { get => (this._disksAndSizeDetail = this._disksAndSizeDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskJobDetailsDisksAndSizeDetails()); } + + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string EncryptionPreferenceDoubleEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceDoubleEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceDoubleEncryption = value ?? null; } + + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string EncryptionPreferenceHardwareEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceHardwareEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceHardwareEncryption = value ?? null; } + + /// + /// The expected size of the data, which needs to be transferred in this job, in terabytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public int? ExpectedDataSizeInTeraByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ExpectedDataSizeInTeraByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ExpectedDataSizeInTeraByte = value ?? default(int); } + + /// Backing field for property. + private System.Collections.Generic.List _granularCopyLogDetail; + + /// Copy progress per disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List GranularCopyLogDetail { get => this._granularCopyLogDetail; } + + /// Backing field for property. + private System.Collections.Generic.List _granularCopyProgress; + + /// Copy progress per disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List GranularCopyProgress { get => this._granularCopyProgress; } + + /// Managed service identity type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string IdentityPropertyType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyType = value ?? null; } + + /// User assigned identity properties. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties IdentityPropertyUserAssigned { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned = value ?? null /* model class */; } + + /// List of stages that run in the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List JobStage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).JobStage; } + + /// Details about which key encryption type is being used. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey KeyEncryptionKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey = value ?? null /* model class */; } + + /// Managed identity properties used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties KeyEncryptionKeyIdentityProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty = value ?? null /* model class */; } + + /// Type of encryption key used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string KeyEncryptionKeyKekType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekType = value ?? null; } + + /// Key encryption key. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string KeyEncryptionKeyKekUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekUrl = value ?? null; } + + /// Kek vault resource id. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string KeyEncryptionKeyKekVaultResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekVaultResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekVaultResourceId = value ?? null; } + + /// Last mitigation action performed on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob LastMitigationActionOnJob { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob = value ?? null /* model class */; } + + /// Action performed date time + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public global::System.DateTime? LastMitigationActionOnJobActionDateTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobActionDateTimeInUtc; } + + /// Resolution code provided by customer + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string LastMitigationActionOnJobCustomerResolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobCustomerResolution; } + + /// + /// Action performed by customer, + /// possibility is that mitigation might happen by customer or service or by ops + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? LastMitigationActionOnJobIsPerformedByCustomer { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobIsPerformedByCustomer; } + + /// Internal Acessors for CopyProgress + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal.CopyProgress { get => this._copyProgress; set { {_copyProgress = value;} } } + + /// Internal Acessors for DisksAndSizeDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal.DisksAndSizeDetail { get => (this._disksAndSizeDetail = this._disksAndSizeDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskJobDetailsDisksAndSizeDetails()); set { {_disksAndSizeDetail = value;} } } + + /// Internal Acessors for GranularCopyLogDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal.GranularCopyLogDetail { get => this._granularCopyLogDetail; set { {_granularCopyLogDetail = value;} } } + + /// Internal Acessors for GranularCopyProgress + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsInternal.GranularCopyProgress { get => this._granularCopyProgress; set { {_granularCopyProgress = value;} } } + + /// Internal Acessors for Action + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Action; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Action = value ?? null /* arrayOf */; } + + /// Internal Acessors for ChainOfCustodySasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ChainOfCustodySasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ChainOfCustodySasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ChainOfCustodySasKey = value ?? null; } + + /// Internal Acessors for ContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail = value ?? null /* model class */; } + + /// Internal Acessors for CopyLogDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.CopyLogDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CopyLogDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CopyLogDetail = value ?? null /* arrayOf */; } + + /// Internal Acessors for DataCenterCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DataCenterCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataCenterCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataCenterCode = value ?? null; } + + /// Internal Acessors for DatacenterAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress = value ?? null /* model class */; } + + /// Internal Acessors for DatacenterAddressDataCenterAzureLocation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressDataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressDataCenterAzureLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressDataCenterAzureLocation = value ?? null; } + + /// Internal Acessors for DatacenterAddressSupportedCarriersForReturnShipment + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressSupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressSupportedCarriersForReturnShipment; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressSupportedCarriersForReturnShipment = value ?? null /* arrayOf */; } + + /// Internal Acessors for DatacenterAddressType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressType = value ?? null; } + + /// Internal Acessors for DeliveryPackage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage = value ?? null /* model class */; } + + /// Internal Acessors for DeliveryPackageCarrierName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageCarrierName = value ?? null; } + + /// Internal Acessors for DeliveryPackageTrackingId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingId = value ?? null; } + + /// Internal Acessors for DeliveryPackageTrackingUrl + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingUrl = value ?? null; } + + /// Internal Acessors for DeviceErasureDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail = value ?? null /* model class */; } + + /// Internal Acessors for DeviceErasureDetailDeviceErasureStatus + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailDeviceErasureStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailDeviceErasureStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailDeviceErasureStatus = value ?? null; } + + /// Internal Acessors for DeviceErasureDetailErasureOrDestructionCertificateSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailErasureOrDestructionCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailErasureOrDestructionCertificateSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailErasureOrDestructionCertificateSasKey = value ?? null; } + + /// Internal Acessors for DeviceErasureDetailSecureErasureCertificateSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailSecureErasureCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailSecureErasureCertificateSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailSecureErasureCertificateSasKey = value ?? null; } + + /// Internal Acessors for IdentityPropertyUserAssigned + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.IdentityPropertyUserAssigned { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned = value ?? null /* model class */; } + + /// Internal Acessors for JobStage + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.JobStage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).JobStage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).JobStage = value ?? null /* arrayOf */; } + + /// Internal Acessors for KeyEncryptionKey + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.KeyEncryptionKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey = value ?? null /* model class */; } + + /// Internal Acessors for KeyEncryptionKeyIdentityProperty + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.KeyEncryptionKeyIdentityProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty = value ?? null /* model class */; } + + /// Internal Acessors for LastMitigationActionOnJob + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJob { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob = value ?? null /* model class */; } + + /// Internal Acessors for LastMitigationActionOnJobActionDateTimeInUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobActionDateTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobActionDateTimeInUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobActionDateTimeInUtc = value ?? default(global::System.DateTime); } + + /// Internal Acessors for LastMitigationActionOnJobCustomerResolution + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobCustomerResolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobCustomerResolution; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobCustomerResolution = value ?? null; } + + /// Internal Acessors for LastMitigationActionOnJobIsPerformedByCustomer + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobIsPerformedByCustomer { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobIsPerformedByCustomer; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobIsPerformedByCustomer = value ?? default(bool); } + + /// Internal Acessors for Preference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.Preference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceEncryptionPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceEncryptionPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceReverseTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceReverseTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for ReturnPackage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage = value ?? null /* model class */; } + + /// Internal Acessors for ReturnPackageCarrierName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageCarrierName = value ?? null; } + + /// Internal Acessors for ReturnPackageTrackingId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingId = value ?? null; } + + /// Internal Acessors for ReturnPackageTrackingUrl + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingUrl = value ?? null; } + + /// Internal Acessors for ReverseShipmentLabelSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShipmentLabelSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShipmentLabelSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShipmentLabelSasKey = value ?? null; } + + /// Internal Acessors for ReverseShippingDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail = value ?? null /* model class */; } + + /// Internal Acessors for ReverseShippingDetailContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail = value ?? null /* model class */; } + + /// Internal Acessors for ReverseShippingDetailIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailIsUpdated = value ?? default(bool); } + + /// Internal Acessors for ReverseShippingDetailShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress = value ?? null /* model class */; } + + /// Internal Acessors for ReverseTransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferenceIsUpdated = value ?? default(bool); } + + /// Internal Acessors for ShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress = value ?? null /* model class */; } + + /// Internal Acessors for TransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferenceIsUpdated = value ?? default(bool); } + + /// Backing field for property. + private string _passkey; + + /// User entered passkey for DataBox Disk job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Passkey { get => this._passkey; set => this._passkey = value; } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string PostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PostalCode = value ?? null; } + + /// Preferences for the order. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Preference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference = value ?? null /* model class */; } + + /// Preferences related to the Encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences PreferenceEncryptionPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference = value ?? null /* model class */; } + + /// Preferred data center region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List PreferencePreferredDataCenterRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferencePreferredDataCenterRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferencePreferredDataCenterRegion = value ?? null /* arrayOf */; } + + /// Optional Preferences related to the reverse shipment logistics of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceReverseTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference = value ?? null /* model class */; } + + /// Preferences related to the Access Tier of storage accounts. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceStorageAccountAccessTierPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceStorageAccountAccessTierPreference = value ?? null /* arrayOf */; } + + /// Preferences related to the shipment logistics of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference = value ?? null /* model class */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks _preferredDisk; + + /// + /// User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} + /// means 5 disks of 2 TB size. Key is string but will be checked against an int. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks PreferredDisk { get => (this._preferredDisk = this._preferredDisk ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskJobDetailsPreferredDisks()); set => this._preferredDisk = value; } + + /// Return package shipping details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails ReturnPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage = value ?? null /* model class */; } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageCarrierName; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReturnPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingId; } + + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReturnPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingUrl; } + + /// Shared access key to download the return shipment label + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShipmentLabelSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShipmentLabelSasKey; } + + /// Optional Reverse Shipping details for order. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails ReverseShippingDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail = value ?? null /* model class */; } + + /// Contact Info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo ReverseShippingDetailContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail = value ?? null /* model class */; } + + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? ReverseShippingDetailIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailIsUpdated; } + + /// Shipping address where customer wishes to receive the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ReverseShippingDetailShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress = value ?? null /* model class */; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactDetailsMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsMobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsMobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactDetailsPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhone = value ?? null; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactDetailsPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhoneExtension = value ?? null; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactName = value ?? null; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCity = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressCompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCompanyName = value ?? null; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressCountry { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCountry; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCountry = value ?? null; } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressPostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressPostalCode = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? ReverseShippingDetailsShippingAddressSkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressSkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressSkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressTaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressTaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = value ?? null; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressType = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressZipExtendedCode = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseTransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferencePreferredShipmentType = value ?? null; } + + /// Shipping address of the customer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress = value ?? null /* model class */; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddressType = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? SkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).SkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).SkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string TaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TaxIdentificationNumber = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string TransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferencePreferredShipmentType = value ?? null; } + + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => "DataBoxDisk"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Type = "DataBoxDisk"; } + + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string UserAssignedResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).UserAssignedResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).UserAssignedResourceId = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ZipExtendedCode = value ?? null; } + + /// Creates an new instance. + public DataBoxDiskJobDetails() + { + this.__jobDetails.Type = "DataBoxDisk"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobDetails), __jobDetails); + await eventListener.AssertObjectIsValid(nameof(__jobDetails), __jobDetails); + } + } + /// DataBox Disk Job Details. + public partial interface IDataBoxDiskJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails + { + /// Copy progress per disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Copy progress per disk.", + SerializedName = @"copyProgress", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskCopyProgress) })] + System.Collections.Generic.List CopyProgress { get; } + /// + /// Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped + /// to the customer. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.", + SerializedName = @"disksAndSizeDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails DisksAndSizeDetail { get; } + /// Copy progress per disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Copy progress per disk.", + SerializedName = @"granularCopyLogDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetails) })] + System.Collections.Generic.List GranularCopyLogDetail { get; } + /// Copy progress per disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Copy progress per disk.", + SerializedName = @"granularCopyProgress", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyProgress) })] + System.Collections.Generic.List GranularCopyProgress { get; } + /// User entered passkey for DataBox Disk job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"User entered passkey for DataBox Disk job.", + SerializedName = @"passkey", + PossibleTypes = new [] { typeof(string) })] + string Passkey { get; set; } + /// + /// User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} + /// means 5 disks of 2 TB size. Key is string but will be checked against an int. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.", + SerializedName = @"preferredDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks PreferredDisk { get; set; } + + } + /// DataBox Disk Job Details. + internal partial interface IDataBoxDiskJobDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal + { + /// Copy progress per disk. + System.Collections.Generic.List CopyProgress { get; set; } + /// + /// Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped + /// to the customer. + /// + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails DisksAndSizeDetail { get; set; } + /// Copy progress per disk. + System.Collections.Generic.List GranularCopyLogDetail { get; set; } + /// Copy progress per disk. + System.Collections.Generic.List GranularCopyProgress { get; set; } + /// User entered passkey for DataBox Disk job. + string Passkey { get; set; } + /// + /// User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} + /// means 5 disks of 2 TB size. Key is string but will be checked against an int. + /// + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks PreferredDisk { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.json.cs new file mode 100644 index 00000000000..1752dd129f7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetails.json.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// DataBox Disk Job Details. + public partial class DataBoxDiskJobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxDiskJobDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetails(json); + {_preferredDisk = If( json?.PropertyT("preferredDisks"), out var __jsonPreferredDisks) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskJobDetailsPreferredDisks.FromJson(__jsonPreferredDisks) : _preferredDisk;} + {_copyProgress = If( json?.PropertyT("copyProgress"), out var __jsonCopyProgress) ? If( __jsonCopyProgress as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDataBoxDiskCopyProgress) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskCopyProgress.FromJson(__u) )) ))() : null : _copyProgress;} + {_granularCopyProgress = If( json?.PropertyT("granularCopyProgress"), out var __jsonGranularCopyProgress) ? If( __jsonGranularCopyProgress as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDataBoxDiskGranularCopyProgress) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskGranularCopyProgress.FromJson(__p) )) ))() : null : _granularCopyProgress;} + {_granularCopyLogDetail = If( json?.PropertyT("granularCopyLogDetails"), out var __jsonGranularCopyLogDetails) ? If( __jsonGranularCopyLogDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __l) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskGranularCopyLogDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskGranularCopyLogDetails.FromJson(__k) )) ))() : null : _granularCopyLogDetail;} + {_disksAndSizeDetail = If( json?.PropertyT("disksAndSizeDetails"), out var __jsonDisksAndSizeDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskJobDetailsDisksAndSizeDetails.FromJson(__jsonDisksAndSizeDetails) : _disksAndSizeDetail;} + {_passkey = If( json?.PropertyT("passkey"), out var __jsonPasskey) ? (string)__jsonPasskey : (string)_passkey;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxDiskJobDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobDetails?.ToJson(container, serializationMode); + AddIf( null != this._preferredDisk ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._preferredDisk.ToJson(null,serializationMode) : null, "preferredDisks" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._copyProgress) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._copyProgress ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("copyProgress",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._granularCopyProgress) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __s in this._granularCopyProgress ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("granularCopyProgress",__r); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._granularCopyLogDetail) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __n in this._granularCopyLogDetail ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("granularCopyLogDetails",__m); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._disksAndSizeDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._disksAndSizeDetail.ToJson(null,serializationMode) : null, "disksAndSizeDetails" ,container.Add ); + } + AddIf( null != (((object)this._passkey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._passkey.ToString()) : null, "passkey" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.PowerShell.cs new file mode 100644 index 00000000000..5cebe945e52 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.PowerShell.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped + /// to the customer. + /// + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskJobDetailsDisksAndSizeDetailsTypeConverter))] + public partial class DataBoxDiskJobDetailsDisksAndSizeDetails + { + + /// + /// 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 DataBoxDiskJobDetailsDisksAndSizeDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DataBoxDiskJobDetailsDisksAndSizeDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + 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.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxDiskJobDetailsDisksAndSizeDetails(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.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxDiskJobDetailsDisksAndSizeDetails(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.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped + /// to the customer. + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskJobDetailsDisksAndSizeDetailsTypeConverter))] + public partial interface IDataBoxDiskJobDetailsDisksAndSizeDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.TypeConverter.cs new file mode 100644 index 00000000000..34574ac848c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxDiskJobDetailsDisksAndSizeDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxDiskJobDetailsDisksAndSizeDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxDiskJobDetailsDisksAndSizeDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxDiskJobDetailsDisksAndSizeDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.cs new file mode 100644 index 00000000000..234bd623361 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped + /// to the customer. + /// + public partial class DataBoxDiskJobDetailsDisksAndSizeDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetailsInternal + { + + /// + /// Creates an new instance. + /// + public DataBoxDiskJobDetailsDisksAndSizeDetails() + { + + } + } + /// Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped + /// to the customer. + public partial interface IDataBoxDiskJobDetailsDisksAndSizeDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + + } + /// Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped + /// to the customer. + internal partial interface IDataBoxDiskJobDetailsDisksAndSizeDetailsInternal + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.dictionary.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.dictionary.cs new file mode 100644 index 00000000000..8ec7c24d5b9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.dictionary.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class DataBoxDiskJobDetailsDisksAndSizeDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public int this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, int value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out int value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskJobDetailsDisksAndSizeDetails source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.json.cs new file mode 100644 index 00000000000..acbb42a2512 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsDisksAndSizeDetails.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped + /// to the customer. + /// + public partial class DataBoxDiskJobDetailsDisksAndSizeDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + /// + internal DataBoxDiskJobDetailsDisksAndSizeDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsDisksAndSizeDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxDiskJobDetailsDisksAndSizeDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.PowerShell.cs new file mode 100644 index 00000000000..5feaeb01a76 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} + /// means 5 disks of 2 TB size. Key is string but will be checked against an int. + /// + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskJobDetailsPreferredDisksTypeConverter))] + public partial class DataBoxDiskJobDetailsPreferredDisks + { + + /// + /// 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 DataBoxDiskJobDetailsPreferredDisks(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DataBoxDiskJobDetailsPreferredDisks(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + 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.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxDiskJobDetailsPreferredDisks(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.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxDiskJobDetailsPreferredDisks(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.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} + /// means 5 disks of 2 TB size. Key is string but will be checked against an int. + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskJobDetailsPreferredDisksTypeConverter))] + public partial interface IDataBoxDiskJobDetailsPreferredDisks + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.TypeConverter.cs new file mode 100644 index 00000000000..7a36df9ed3b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxDiskJobDetailsPreferredDisksTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxDiskJobDetailsPreferredDisks.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxDiskJobDetailsPreferredDisks.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxDiskJobDetailsPreferredDisks.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.cs new file mode 100644 index 00000000000..80c6ce0c9ac --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} + /// means 5 disks of 2 TB size. Key is string but will be checked against an int. + /// + public partial class DataBoxDiskJobDetailsPreferredDisks : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisksInternal + { + + /// Creates an new instance. + public DataBoxDiskJobDetailsPreferredDisks() + { + + } + } + /// User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} + /// means 5 disks of 2 TB size. Key is string but will be checked against an int. + public partial interface IDataBoxDiskJobDetailsPreferredDisks : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + + } + /// User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} + /// means 5 disks of 2 TB size. Key is string but will be checked against an int. + internal partial interface IDataBoxDiskJobDetailsPreferredDisksInternal + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.dictionary.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.dictionary.cs new file mode 100644 index 00000000000..f6c2a689f35 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.dictionary.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class DataBoxDiskJobDetailsPreferredDisks : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public int this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, int value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out int value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxDiskJobDetailsPreferredDisks source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.json.cs new file mode 100644 index 00000000000..0dcb5b9ccb0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobDetailsPreferredDisks.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} + /// means 5 disks of 2 TB size. Key is string but will be checked against an int. + /// + public partial class DataBoxDiskJobDetailsPreferredDisks + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + /// + internal DataBoxDiskJobDetailsPreferredDisks(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetailsPreferredDisks FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxDiskJobDetailsPreferredDisks(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.PowerShell.cs new file mode 100644 index 00000000000..c2fa14e404f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.PowerShell.cs @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The secrets related to disk job. + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskJobSecretsTypeConverter))] + public partial class DataBoxDiskJobSecrets + { + + /// + /// 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 DataBoxDiskJobSecrets(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskSecret")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal)this).DiskSecret = (System.Collections.Generic.List) content.GetValueForProperty("DiskSecret",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal)this).DiskSecret, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DiskSecretTypeConverter.ConvertFrom)); + } + if (content.Contains("PassKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal)this).PassKey = (string) content.GetValueForProperty("PassKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal)this).PassKey, global::System.Convert.ToString); + } + if (content.Contains("IsPasskeyUserDefined")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal)this).IsPasskeyUserDefined = (bool?) content.GetValueForProperty("IsPasskeyUserDefined",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal)this).IsPasskeyUserDefined, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DcAccessSecurityCodeReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode) content.GetValueForProperty("DcAccessSecurityCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCodeTypeConverter.ConvertFrom); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type, 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 DataBoxDiskJobSecrets(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskSecret")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal)this).DiskSecret = (System.Collections.Generic.List) content.GetValueForProperty("DiskSecret",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal)this).DiskSecret, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DiskSecretTypeConverter.ConvertFrom)); + } + if (content.Contains("PassKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal)this).PassKey = (string) content.GetValueForProperty("PassKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal)this).PassKey, global::System.Convert.ToString); + } + if (content.Contains("IsPasskeyUserDefined")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal)this).IsPasskeyUserDefined = (bool?) content.GetValueForProperty("IsPasskeyUserDefined",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal)this).IsPasskeyUserDefined, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DcAccessSecurityCodeReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode) content.GetValueForProperty("DcAccessSecurityCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCodeTypeConverter.ConvertFrom); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type, 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.DataBox.Models.IDataBoxDiskJobSecrets DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxDiskJobSecrets(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.DataBox.Models.IDataBoxDiskJobSecrets DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxDiskJobSecrets(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.DataBox.Models.IDataBoxDiskJobSecrets FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 secrets related to disk job. + [System.ComponentModel.TypeConverter(typeof(DataBoxDiskJobSecretsTypeConverter))] + public partial interface IDataBoxDiskJobSecrets + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.TypeConverter.cs new file mode 100644 index 00000000000..4452c83f8be --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxDiskJobSecretsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecrets ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecrets).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxDiskJobSecrets.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxDiskJobSecrets.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxDiskJobSecrets.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.cs new file mode 100644 index 00000000000..d3f8b01378d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The secrets related to disk job. + public partial class DataBoxDiskJobSecrets : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecrets, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets __jobSecrets = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecrets(); + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).AdditionalInfo; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Code; } + + /// Dc Access Security Code for Customer Managed Shipping + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode DcAccessSecurityCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode = value ?? null /* model class */; } + + /// Forward Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DcAccessSecurityCodeForwardDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeForwardDcAccessCode; } + + /// Reverse Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DcAccessSecurityCodeReverseDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeReverseDcAccessCode; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Detail; } + + /// Backing field for property. + private System.Collections.Generic.List _diskSecret; + + /// Contains the list of secrets object for that device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List DiskSecret { get => this._diskSecret; } + + /// Error while fetching the secrets. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error = value ?? null /* model class */; } + + /// Backing field for property. + private bool? _isPasskeyUserDefined; + + /// Whether passkey was provided by user. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? IsPasskeyUserDefined { get => this._isPasskeyUserDefined; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Message; } + + /// Internal Acessors for DiskSecret + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal.DiskSecret { get => this._diskSecret; set { {_diskSecret = value;} } } + + /// Internal Acessors for IsPasskeyUserDefined + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal.IsPasskeyUserDefined { get => this._isPasskeyUserDefined; set { {_isPasskeyUserDefined = value;} } } + + /// Internal Acessors for PassKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecretsInternal.PassKey { get => this._passKey; set { {_passKey = value;} } } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Code = value ?? null; } + + /// Internal Acessors for DcAccessSecurityCode + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode = value ?? null /* model class */; } + + /// Internal Acessors for DcAccessSecurityCodeForwardDcAccessCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCodeForwardDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeForwardDcAccessCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeForwardDcAccessCode = value ?? null; } + + /// Internal Acessors for DcAccessSecurityCodeReverseDcAccessCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCodeReverseDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeReverseDcAccessCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeReverseDcAccessCode = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error = value ?? null /* model class */; } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Target = value ?? null; } + + /// Backing field for property. + private string _passKey; + + /// PassKey for the disk Job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string PassKey { get => this._passKey; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Target; } + + /// Used to indicate what type of job secrets object. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => "DataBoxDisk"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Type = "DataBoxDisk"; } + + /// Creates an new instance. + public DataBoxDiskJobSecrets() + { + this.__jobSecrets.Type = "DataBoxDisk"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobSecrets), __jobSecrets); + await eventListener.AssertObjectIsValid(nameof(__jobSecrets), __jobSecrets); + } + } + /// The secrets related to disk job. + public partial interface IDataBoxDiskJobSecrets : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets + { + /// Contains the list of secrets object for that device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Contains the list of secrets object for that device.", + SerializedName = @"diskSecrets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecret) })] + System.Collections.Generic.List DiskSecret { get; } + /// Whether passkey was provided by user. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Whether passkey was provided by user.", + SerializedName = @"isPasskeyUserDefined", + PossibleTypes = new [] { typeof(bool) })] + bool? IsPasskeyUserDefined { get; } + /// PassKey for the disk Job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"PassKey for the disk Job.", + SerializedName = @"passKey", + PossibleTypes = new [] { typeof(string) })] + string PassKey { get; } + + } + /// The secrets related to disk job. + internal partial interface IDataBoxDiskJobSecretsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal + { + /// Contains the list of secrets object for that device. + System.Collections.Generic.List DiskSecret { get; set; } + /// Whether passkey was provided by user. + bool? IsPasskeyUserDefined { get; set; } + /// PassKey for the disk Job. + string PassKey { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.json.cs new file mode 100644 index 00000000000..a8bf3ed1785 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxDiskJobSecrets.json.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The secrets related to disk job. + public partial class DataBoxDiskJobSecrets + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxDiskJobSecrets(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobSecrets = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecrets(json); + {_diskSecret = If( json?.PropertyT("diskSecrets"), out var __jsonDiskSecrets) ? If( __jsonDiskSecrets as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDiskSecret) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DiskSecret.FromJson(__u) )) ))() : null : _diskSecret;} + {_passKey = If( json?.PropertyT("passKey"), out var __jsonPassKey) ? (string)__jsonPassKey : (string)_passKey;} + {_isPasskeyUserDefined = If( json?.PropertyT("isPasskeyUserDefined"), out var __jsonIsPasskeyUserDefined) ? (bool?)__jsonIsPasskeyUserDefined : _isPasskeyUserDefined;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecrets. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecrets. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobSecrets FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxDiskJobSecrets(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobSecrets?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._diskSecret) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._diskSecret ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("diskSecrets",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._passKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._passKey.ToString()) : null, "passKey" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._isPasskeyUserDefined ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._isPasskeyUserDefined) : null, "isPasskeyUserDefined" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.PowerShell.cs new file mode 100644 index 00000000000..c9090965ad8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Copy log details for a storage account for Databox heavy + [System.ComponentModel.TypeConverter(typeof(DataBoxHeavyAccountCopyLogDetailsTypeConverter))] + public partial class DataBoxHeavyAccountCopyLogDetails + { + + /// + /// 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 DataBoxHeavyAccountCopyLogDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal)this).AccountName = (string) content.GetValueForProperty("AccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal)this).AccountName, global::System.Convert.ToString); + } + if (content.Contains("CopyLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal)this).CopyLogLink = (System.Collections.Generic.List) content.GetValueForProperty("CopyLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal)this).CopyLogLink, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("CopyVerboseLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal)this).CopyVerboseLogLink = (System.Collections.Generic.List) content.GetValueForProperty("CopyVerboseLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal)this).CopyVerboseLogLink, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type, 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 DataBoxHeavyAccountCopyLogDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal)this).AccountName = (string) content.GetValueForProperty("AccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal)this).AccountName, global::System.Convert.ToString); + } + if (content.Contains("CopyLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal)this).CopyLogLink = (System.Collections.Generic.List) content.GetValueForProperty("CopyLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal)this).CopyLogLink, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("CopyVerboseLogLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal)this).CopyVerboseLogLink = (System.Collections.Generic.List) content.GetValueForProperty("CopyVerboseLogLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal)this).CopyVerboseLogLink, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)this).Type, 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.DataBox.Models.IDataBoxHeavyAccountCopyLogDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxHeavyAccountCopyLogDetails(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.DataBox.Models.IDataBoxHeavyAccountCopyLogDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxHeavyAccountCopyLogDetails(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.DataBox.Models.IDataBoxHeavyAccountCopyLogDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Copy log details for a storage account for Databox heavy + [System.ComponentModel.TypeConverter(typeof(DataBoxHeavyAccountCopyLogDetailsTypeConverter))] + public partial interface IDataBoxHeavyAccountCopyLogDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.TypeConverter.cs new file mode 100644 index 00000000000..beb72359c85 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxHeavyAccountCopyLogDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxHeavyAccountCopyLogDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxHeavyAccountCopyLogDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxHeavyAccountCopyLogDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.cs new file mode 100644 index 00000000000..6011bc47e9c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Copy log details for a storage account for Databox heavy + public partial class DataBoxHeavyAccountCopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails __copyLogDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetails(); + + /// Backing field for property. + private string _accountName; + + /// Account name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string AccountName { get => this._accountName; } + + /// Backing field for property. + private System.Collections.Generic.List _copyLogLink; + + /// Link for copy logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List CopyLogLink { get => this._copyLogLink; } + + /// Backing field for property. + private System.Collections.Generic.List _copyVerboseLogLink; + + /// + /// Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List CopyVerboseLogLink { get => this._copyVerboseLogLink; } + + /// Internal Acessors for AccountName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal.AccountName { get => this._accountName; set { {_accountName = value;} } } + + /// Internal Acessors for CopyLogLink + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal.CopyLogLink { get => this._copyLogLink; set { {_copyLogLink = value;} } } + + /// Internal Acessors for CopyVerboseLogLink + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetailsInternal.CopyVerboseLogLink { get => this._copyVerboseLogLink; set { {_copyVerboseLogLink = value;} } } + + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => "DataBoxHeavy"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal)__copyLogDetails).Type = "DataBoxHeavy"; } + + /// Creates an new instance. + public DataBoxHeavyAccountCopyLogDetails() + { + this.__copyLogDetails.Type = "DataBoxHeavy"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__copyLogDetails), __copyLogDetails); + await eventListener.AssertObjectIsValid(nameof(__copyLogDetails), __copyLogDetails); + } + } + /// Copy log details for a storage account for Databox heavy + public partial interface IDataBoxHeavyAccountCopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails + { + /// Account name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Account name.", + SerializedName = @"accountName", + PossibleTypes = new [] { typeof(string) })] + string AccountName { get; } + /// Link for copy logs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Link for copy logs.", + SerializedName = @"copyLogLink", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List CopyLogLink { get; } + /// + /// Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose.", + SerializedName = @"copyVerboseLogLink", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List CopyVerboseLogLink { get; } + + } + /// Copy log details for a storage account for Databox heavy + internal partial interface IDataBoxHeavyAccountCopyLogDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetailsInternal + { + /// Account name. + string AccountName { get; set; } + /// Link for copy logs. + System.Collections.Generic.List CopyLogLink { get; set; } + /// + /// Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose. + /// + System.Collections.Generic.List CopyVerboseLogLink { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.json.cs new file mode 100644 index 00000000000..731dcdd7d0f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyAccountCopyLogDetails.json.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Copy log details for a storage account for Databox heavy + public partial class DataBoxHeavyAccountCopyLogDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxHeavyAccountCopyLogDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __copyLogDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetails(json); + {_accountName = If( json?.PropertyT("accountName"), out var __jsonAccountName) ? (string)__jsonAccountName : (string)_accountName;} + {_copyLogLink = If( json?.PropertyT("copyLogLink"), out var __jsonCopyLogLink) ? If( __jsonCopyLogLink as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _copyLogLink;} + {_copyVerboseLogLink = If( json?.PropertyT("copyVerboseLogLink"), out var __jsonCopyVerboseLogLink) ? If( __jsonCopyVerboseLogLink as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : _copyVerboseLogLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyAccountCopyLogDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxHeavyAccountCopyLogDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __copyLogDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._accountName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._accountName.ToString()) : null, "accountName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._copyLogLink) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._copyLogLink ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("copyLogLink",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._copyVerboseLogLink) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __s in this._copyVerboseLogLink ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("copyVerboseLogLink",__r); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.PowerShell.cs new file mode 100644 index 00000000000..717d62833bc --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.PowerShell.cs @@ -0,0 +1,890 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Databox Heavy Device Job Details + [System.ComponentModel.TypeConverter(typeof(DataBoxHeavyJobDetailsTypeConverter))] + public partial class DataBoxHeavyJobDetails + { + + /// + /// 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 DataBoxHeavyJobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CopyProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetailsInternal)this).CopyProgress = (System.Collections.Generic.List) content.GetValueForProperty("CopyProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetailsInternal)this).CopyProgress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyProgressTypeConverter.ConvertFrom)); + } + if (content.Contains("DevicePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetailsInternal)this).DevicePassword = (string) content.GetValueForProperty("DevicePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetailsInternal)this).DevicePassword, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailEmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailEmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContactDetailNotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailNotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ReverseShippingDetailShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyIdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("KeyEncryptionKeyIdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyKekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType = (string) content.GetValueForProperty("KeyEncryptionKeyKekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName = (string) content.GetValueForProperty("ContactDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone = (string) content.GetValueForProperty("ContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension = (string) content.GetValueForProperty("ContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile = (string) content.GetValueForProperty("ContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl = (string) content.GetValueForProperty("DeliveryPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId = (string) content.GetValueForProperty("DeliveryPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl = (string) content.GetValueForProperty("ReturnPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId = (string) content.GetValueForProperty("ReturnPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ReverseShippingDetailContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated = (bool?) content.GetValueForProperty("ReverseShippingDetailIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailDeviceErasureStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus = (string) content.GetValueForProperty("DeviceErasureDetailDeviceErasureStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailErasureOrDestructionCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailErasureOrDestructionCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailSecureErasureCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailSecureErasureCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl = (string) content.GetValueForProperty("KeyEncryptionKeyKekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId = (string) content.GetValueForProperty("KeyEncryptionKeyKekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("LastMitigationActionOnJobActionDateTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastMitigationActionOnJobActionDateTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMitigationActionOnJobIsPerformedByCustomer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer = (bool?) content.GetValueForProperty("LastMitigationActionOnJobIsPerformedByCustomer",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastMitigationActionOnJobCustomerResolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution = (string) content.GetValueForProperty("LastMitigationActionOnJobCustomerResolution",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressSupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("DatacenterAddressSupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DatacenterAddressDataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation = (string) content.GetValueForProperty("DatacenterAddressDataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName = (string) content.GetValueForProperty("ReverseShippingDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ReverseShippingDetailsShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId, global::System.Convert.ToString); + } + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails) content.GetValueForProperty("ReverseShippingDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceErasureDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails) content.GetValueForProperty("DeviceErasureDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey) content.GetValueForProperty("KeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKeyTypeConverter.ConvertFrom); + } + if (content.Contains("LastMitigationActionOnJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob) content.GetValueForProperty("LastMitigationActionOnJob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJobTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse) content.GetValueForProperty("DatacenterAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponseTypeConverter.ConvertFrom); + } + if (content.Contains("JobStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage = (System.Collections.Generic.List) content.GetValueForProperty("JobStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobStagesTypeConverter.ConvertFrom)); + } + if (content.Contains("DataImportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataImportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DataExportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataExportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CopyLogDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail = (System.Collections.Generic.List) content.GetValueForProperty("CopyLogDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReverseShipmentLabelSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey = (string) content.GetValueForProperty("ReverseShipmentLabelSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey, global::System.Convert.ToString); + } + if (content.Contains("ChainOfCustodySasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey = (string) content.GetValueForProperty("ChainOfCustodySasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey, global::System.Convert.ToString); + } + if (content.Contains("ExpectedDataSizeInTeraByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte = (int?) content.GetValueForProperty("ExpectedDataSizeInTeraByte",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode = (string) content.GetValueForProperty("DataCenterCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode, 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 DataBoxHeavyJobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CopyProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetailsInternal)this).CopyProgress = (System.Collections.Generic.List) content.GetValueForProperty("CopyProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetailsInternal)this).CopyProgress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyProgressTypeConverter.ConvertFrom)); + } + if (content.Contains("DevicePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetailsInternal)this).DevicePassword = (string) content.GetValueForProperty("DevicePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetailsInternal)this).DevicePassword, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailEmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailEmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContactDetailNotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailNotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ReverseShippingDetailShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyIdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("KeyEncryptionKeyIdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyKekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType = (string) content.GetValueForProperty("KeyEncryptionKeyKekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName = (string) content.GetValueForProperty("ContactDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone = (string) content.GetValueForProperty("ContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension = (string) content.GetValueForProperty("ContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile = (string) content.GetValueForProperty("ContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl = (string) content.GetValueForProperty("DeliveryPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId = (string) content.GetValueForProperty("DeliveryPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl = (string) content.GetValueForProperty("ReturnPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId = (string) content.GetValueForProperty("ReturnPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ReverseShippingDetailContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated = (bool?) content.GetValueForProperty("ReverseShippingDetailIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailDeviceErasureStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus = (string) content.GetValueForProperty("DeviceErasureDetailDeviceErasureStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailErasureOrDestructionCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailErasureOrDestructionCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailSecureErasureCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailSecureErasureCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl = (string) content.GetValueForProperty("KeyEncryptionKeyKekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId = (string) content.GetValueForProperty("KeyEncryptionKeyKekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("LastMitigationActionOnJobActionDateTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastMitigationActionOnJobActionDateTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMitigationActionOnJobIsPerformedByCustomer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer = (bool?) content.GetValueForProperty("LastMitigationActionOnJobIsPerformedByCustomer",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastMitigationActionOnJobCustomerResolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution = (string) content.GetValueForProperty("LastMitigationActionOnJobCustomerResolution",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressSupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("DatacenterAddressSupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DatacenterAddressDataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation = (string) content.GetValueForProperty("DatacenterAddressDataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName = (string) content.GetValueForProperty("ReverseShippingDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ReverseShippingDetailsShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId, global::System.Convert.ToString); + } + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails) content.GetValueForProperty("ReverseShippingDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceErasureDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails) content.GetValueForProperty("DeviceErasureDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey) content.GetValueForProperty("KeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKeyTypeConverter.ConvertFrom); + } + if (content.Contains("LastMitigationActionOnJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob) content.GetValueForProperty("LastMitigationActionOnJob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJobTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse) content.GetValueForProperty("DatacenterAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponseTypeConverter.ConvertFrom); + } + if (content.Contains("JobStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage = (System.Collections.Generic.List) content.GetValueForProperty("JobStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobStagesTypeConverter.ConvertFrom)); + } + if (content.Contains("DataImportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataImportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DataExportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataExportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CopyLogDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail = (System.Collections.Generic.List) content.GetValueForProperty("CopyLogDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReverseShipmentLabelSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey = (string) content.GetValueForProperty("ReverseShipmentLabelSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey, global::System.Convert.ToString); + } + if (content.Contains("ChainOfCustodySasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey = (string) content.GetValueForProperty("ChainOfCustodySasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey, global::System.Convert.ToString); + } + if (content.Contains("ExpectedDataSizeInTeraByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte = (int?) content.GetValueForProperty("ExpectedDataSizeInTeraByte",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode = (string) content.GetValueForProperty("DataCenterCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode, 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.DataBox.Models.IDataBoxHeavyJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxHeavyJobDetails(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.DataBox.Models.IDataBoxHeavyJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxHeavyJobDetails(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.DataBox.Models.IDataBoxHeavyJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Databox Heavy Device Job Details + [System.ComponentModel.TypeConverter(typeof(DataBoxHeavyJobDetailsTypeConverter))] + public partial interface IDataBoxHeavyJobDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.TypeConverter.cs new file mode 100644 index 00000000000..21bfe59b3d1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxHeavyJobDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxHeavyJobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxHeavyJobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxHeavyJobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.cs new file mode 100644 index 00000000000..3d99f99b213 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Databox Heavy Device Job Details + public partial class DataBoxHeavyJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetails(); + + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Action; } + + /// Shared access key to download the chain of custody logs + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ChainOfCustodySasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ChainOfCustodySasKey; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string City { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).City = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string CompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CompanyName = value ?? null; } + + /// Contact details for notification and shipping. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails ContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail = value ?? null /* model class */; } + + /// List of Email-ids to be notified about job progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List ContactDetailEmailList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailEmailList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailEmailList = value ; } + + /// Notification preference for a job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List ContactDetailNotificationPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailNotificationPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailNotificationPreference = value ?? null /* arrayOf */; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsContactName = value ; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsMobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsMobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhone = value ; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhoneExtension = value ?? null; } + + /// List of copy log details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List CopyLogDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CopyLogDetail; } + + /// Backing field for property. + private System.Collections.Generic.List _copyProgress; + + /// Copy progress per account. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List CopyProgress { get => this._copyProgress; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Country { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Country = value ?? null; } + + /// DataCenter code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DataCenterCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataCenterCode; } + + /// Details of the data to be exported from azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List DataExportDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataExportDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataExportDetail = value ?? null /* arrayOf */; } + + /// Details of the data to be imported into azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List DataImportDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataImportDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataImportDetail = value ?? null /* arrayOf */; } + + /// Datacenter address to ship to, for the given sku and storage location. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse DatacenterAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress = value ?? null /* model class */; } + + /// Azure Location where the Data Center serves primarily. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DatacenterAddressDataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressDataCenterAzureLocation; } + + /// List of supported carriers for return shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List DatacenterAddressSupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressSupportedCarriersForReturnShipment; } + + /// Data center address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DatacenterAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressType; } + + /// Delivery package shipping details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails DeliveryPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage = value ?? null /* model class */; } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageCarrierName; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeliveryPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingId; } + + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeliveryPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingUrl; } + + /// Holds device data erasure details + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails DeviceErasureDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail = value ?? null /* model class */; } + + /// Holds the device erasure completion status + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeviceErasureDetailDeviceErasureStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailDeviceErasureStatus; } + + /// Shared access key to download cleanup or destruction certificate for device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeviceErasureDetailErasureOrDestructionCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailErasureOrDestructionCertificateSasKey; } + + /// Shared access key to download secure erasure certificate for the device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeviceErasureDetailSecureErasureCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailSecureErasureCertificateSasKey; } + + /// Backing field for property. + private string _devicePassword; + + /// + /// Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is + /// not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : + /// Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number + /// and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers + /// and these characters : @#\-$%^!+=;:_()]+ + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DevicePassword { get => this._devicePassword; set => this._devicePassword = value; } + + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string EncryptionPreferenceDoubleEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceDoubleEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceDoubleEncryption = value ?? null; } + + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string EncryptionPreferenceHardwareEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceHardwareEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceHardwareEncryption = value ?? null; } + + /// + /// The expected size of the data, which needs to be transferred in this job, in terabytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public int? ExpectedDataSizeInTeraByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ExpectedDataSizeInTeraByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ExpectedDataSizeInTeraByte = value ?? default(int); } + + /// Managed service identity type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string IdentityPropertyType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyType = value ?? null; } + + /// User assigned identity properties. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties IdentityPropertyUserAssigned { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned = value ?? null /* model class */; } + + /// List of stages that run in the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List JobStage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).JobStage; } + + /// Details about which key encryption type is being used. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey KeyEncryptionKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey = value ?? null /* model class */; } + + /// Managed identity properties used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties KeyEncryptionKeyIdentityProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty = value ?? null /* model class */; } + + /// Type of encryption key used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string KeyEncryptionKeyKekType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekType = value ?? null; } + + /// Key encryption key. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string KeyEncryptionKeyKekUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekUrl = value ?? null; } + + /// Kek vault resource id. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string KeyEncryptionKeyKekVaultResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekVaultResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekVaultResourceId = value ?? null; } + + /// Last mitigation action performed on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob LastMitigationActionOnJob { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob = value ?? null /* model class */; } + + /// Action performed date time + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public global::System.DateTime? LastMitigationActionOnJobActionDateTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobActionDateTimeInUtc; } + + /// Resolution code provided by customer + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string LastMitigationActionOnJobCustomerResolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobCustomerResolution; } + + /// + /// Action performed by customer, + /// possibility is that mitigation might happen by customer or service or by ops + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? LastMitigationActionOnJobIsPerformedByCustomer { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobIsPerformedByCustomer; } + + /// Internal Acessors for CopyProgress + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetailsInternal.CopyProgress { get => this._copyProgress; set { {_copyProgress = value;} } } + + /// Internal Acessors for Action + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Action; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Action = value ?? null /* arrayOf */; } + + /// Internal Acessors for ChainOfCustodySasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ChainOfCustodySasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ChainOfCustodySasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ChainOfCustodySasKey = value ?? null; } + + /// Internal Acessors for ContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail = value ?? null /* model class */; } + + /// Internal Acessors for CopyLogDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.CopyLogDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CopyLogDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CopyLogDetail = value ?? null /* arrayOf */; } + + /// Internal Acessors for DataCenterCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DataCenterCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataCenterCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataCenterCode = value ?? null; } + + /// Internal Acessors for DatacenterAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress = value ?? null /* model class */; } + + /// Internal Acessors for DatacenterAddressDataCenterAzureLocation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressDataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressDataCenterAzureLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressDataCenterAzureLocation = value ?? null; } + + /// Internal Acessors for DatacenterAddressSupportedCarriersForReturnShipment + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressSupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressSupportedCarriersForReturnShipment; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressSupportedCarriersForReturnShipment = value ?? null /* arrayOf */; } + + /// Internal Acessors for DatacenterAddressType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressType = value ?? null; } + + /// Internal Acessors for DeliveryPackage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage = value ?? null /* model class */; } + + /// Internal Acessors for DeliveryPackageCarrierName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageCarrierName = value ?? null; } + + /// Internal Acessors for DeliveryPackageTrackingId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingId = value ?? null; } + + /// Internal Acessors for DeliveryPackageTrackingUrl + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingUrl = value ?? null; } + + /// Internal Acessors for DeviceErasureDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail = value ?? null /* model class */; } + + /// Internal Acessors for DeviceErasureDetailDeviceErasureStatus + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailDeviceErasureStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailDeviceErasureStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailDeviceErasureStatus = value ?? null; } + + /// Internal Acessors for DeviceErasureDetailErasureOrDestructionCertificateSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailErasureOrDestructionCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailErasureOrDestructionCertificateSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailErasureOrDestructionCertificateSasKey = value ?? null; } + + /// Internal Acessors for DeviceErasureDetailSecureErasureCertificateSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailSecureErasureCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailSecureErasureCertificateSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailSecureErasureCertificateSasKey = value ?? null; } + + /// Internal Acessors for IdentityPropertyUserAssigned + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.IdentityPropertyUserAssigned { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned = value ?? null /* model class */; } + + /// Internal Acessors for JobStage + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.JobStage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).JobStage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).JobStage = value ?? null /* arrayOf */; } + + /// Internal Acessors for KeyEncryptionKey + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.KeyEncryptionKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey = value ?? null /* model class */; } + + /// Internal Acessors for KeyEncryptionKeyIdentityProperty + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.KeyEncryptionKeyIdentityProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty = value ?? null /* model class */; } + + /// Internal Acessors for LastMitigationActionOnJob + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJob { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob = value ?? null /* model class */; } + + /// Internal Acessors for LastMitigationActionOnJobActionDateTimeInUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobActionDateTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobActionDateTimeInUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobActionDateTimeInUtc = value ?? default(global::System.DateTime); } + + /// Internal Acessors for LastMitigationActionOnJobCustomerResolution + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobCustomerResolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobCustomerResolution; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobCustomerResolution = value ?? null; } + + /// Internal Acessors for LastMitigationActionOnJobIsPerformedByCustomer + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobIsPerformedByCustomer { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobIsPerformedByCustomer; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobIsPerformedByCustomer = value ?? default(bool); } + + /// Internal Acessors for Preference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.Preference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceEncryptionPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceEncryptionPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceReverseTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceReverseTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for ReturnPackage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage = value ?? null /* model class */; } + + /// Internal Acessors for ReturnPackageCarrierName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageCarrierName = value ?? null; } + + /// Internal Acessors for ReturnPackageTrackingId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingId = value ?? null; } + + /// Internal Acessors for ReturnPackageTrackingUrl + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingUrl = value ?? null; } + + /// Internal Acessors for ReverseShipmentLabelSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShipmentLabelSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShipmentLabelSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShipmentLabelSasKey = value ?? null; } + + /// Internal Acessors for ReverseShippingDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail = value ?? null /* model class */; } + + /// Internal Acessors for ReverseShippingDetailContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail = value ?? null /* model class */; } + + /// Internal Acessors for ReverseShippingDetailIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailIsUpdated = value ?? default(bool); } + + /// Internal Acessors for ReverseShippingDetailShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress = value ?? null /* model class */; } + + /// Internal Acessors for ReverseTransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferenceIsUpdated = value ?? default(bool); } + + /// Internal Acessors for ShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress = value ?? null /* model class */; } + + /// Internal Acessors for TransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferenceIsUpdated = value ?? default(bool); } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string PostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PostalCode = value ?? null; } + + /// Preferences for the order. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Preference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference = value ?? null /* model class */; } + + /// Preferences related to the Encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences PreferenceEncryptionPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference = value ?? null /* model class */; } + + /// Preferred data center region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List PreferencePreferredDataCenterRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferencePreferredDataCenterRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferencePreferredDataCenterRegion = value ?? null /* arrayOf */; } + + /// Optional Preferences related to the reverse shipment logistics of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceReverseTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference = value ?? null /* model class */; } + + /// Preferences related to the Access Tier of storage accounts. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceStorageAccountAccessTierPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceStorageAccountAccessTierPreference = value ?? null /* arrayOf */; } + + /// Preferences related to the shipment logistics of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference = value ?? null /* model class */; } + + /// Return package shipping details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails ReturnPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage = value ?? null /* model class */; } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageCarrierName; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReturnPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingId; } + + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReturnPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingUrl; } + + /// Shared access key to download the return shipment label + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShipmentLabelSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShipmentLabelSasKey; } + + /// Optional Reverse Shipping details for order. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails ReverseShippingDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail = value ?? null /* model class */; } + + /// Contact Info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo ReverseShippingDetailContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail = value ?? null /* model class */; } + + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? ReverseShippingDetailIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailIsUpdated; } + + /// Shipping address where customer wishes to receive the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ReverseShippingDetailShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress = value ?? null /* model class */; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactDetailsMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsMobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsMobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactDetailsPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhone = value ?? null; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactDetailsPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhoneExtension = value ?? null; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactName = value ?? null; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCity = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressCompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCompanyName = value ?? null; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressCountry { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCountry; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCountry = value ?? null; } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressPostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressPostalCode = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? ReverseShippingDetailsShippingAddressSkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressSkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressSkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressTaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressTaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = value ?? null; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressType = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressZipExtendedCode = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseTransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferencePreferredShipmentType = value ?? null; } + + /// Shipping address of the customer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress = value ?? null /* model class */; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddressType = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? SkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).SkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).SkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string TaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TaxIdentificationNumber = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string TransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferencePreferredShipmentType = value ?? null; } + + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => "DataBoxHeavy"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Type = "DataBoxHeavy"; } + + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string UserAssignedResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).UserAssignedResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).UserAssignedResourceId = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ZipExtendedCode = value ?? null; } + + /// Creates an new instance. + public DataBoxHeavyJobDetails() + { + this.__jobDetails.Type = "DataBoxHeavy"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobDetails), __jobDetails); + await eventListener.AssertObjectIsValid(nameof(__jobDetails), __jobDetails); + } + } + /// Databox Heavy Device Job Details + public partial interface IDataBoxHeavyJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails + { + /// Copy progress per account. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Copy progress per account.", + SerializedName = @"copyProgress", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgress) })] + System.Collections.Generic.List CopyProgress { get; } + /// + /// Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is + /// not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : + /// Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number + /// and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers + /// and these characters : @#\-$%^!+=;:_()]+ + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+", + SerializedName = @"devicePassword", + PossibleTypes = new [] { typeof(string) })] + string DevicePassword { get; set; } + + } + /// Databox Heavy Device Job Details + internal partial interface IDataBoxHeavyJobDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal + { + /// Copy progress per account. + System.Collections.Generic.List CopyProgress { get; set; } + /// + /// Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is + /// not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : + /// Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number + /// and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers + /// and these characters : @#\-$%^!+=;:_()]+ + /// + string DevicePassword { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.json.cs new file mode 100644 index 00000000000..fc449b751e1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobDetails.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Databox Heavy Device Job Details + public partial class DataBoxHeavyJobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxHeavyJobDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetails(json); + {_copyProgress = If( json?.PropertyT("copyProgress"), out var __jsonCopyProgress) ? If( __jsonCopyProgress as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.ICopyProgress) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyProgress.FromJson(__u) )) ))() : null : _copyProgress;} + {_devicePassword = If( json?.PropertyT("devicePassword"), out var __jsonDevicePassword) ? (string)__jsonDevicePassword : (string)_devicePassword;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxHeavyJobDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._copyProgress) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._copyProgress ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("copyProgress",__w); + } + } + AddIf( null != (((object)this._devicePassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._devicePassword.ToString()) : null, "devicePassword" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.PowerShell.cs new file mode 100644 index 00000000000..7bc9988a673 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.PowerShell.cs @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The secrets related to a databox heavy job. + [System.ComponentModel.TypeConverter(typeof(DataBoxHeavyJobSecretsTypeConverter))] + public partial class DataBoxHeavyJobSecrets + { + + /// + /// 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 DataBoxHeavyJobSecrets(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CabinetPodSecret")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobSecretsInternal)this).CabinetPodSecret = (System.Collections.Generic.List) content.GetValueForProperty("CabinetPodSecret",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobSecretsInternal)this).CabinetPodSecret, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxHeavySecretTypeConverter.ConvertFrom)); + } + if (content.Contains("DcAccessSecurityCodeReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode) content.GetValueForProperty("DcAccessSecurityCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCodeTypeConverter.ConvertFrom); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type, 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 DataBoxHeavyJobSecrets(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CabinetPodSecret")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobSecretsInternal)this).CabinetPodSecret = (System.Collections.Generic.List) content.GetValueForProperty("CabinetPodSecret",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobSecretsInternal)this).CabinetPodSecret, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxHeavySecretTypeConverter.ConvertFrom)); + } + if (content.Contains("DcAccessSecurityCodeReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode) content.GetValueForProperty("DcAccessSecurityCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCodeTypeConverter.ConvertFrom); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type, 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.DataBox.Models.IDataBoxHeavyJobSecrets DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxHeavyJobSecrets(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.DataBox.Models.IDataBoxHeavyJobSecrets DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxHeavyJobSecrets(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.DataBox.Models.IDataBoxHeavyJobSecrets FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 secrets related to a databox heavy job. + [System.ComponentModel.TypeConverter(typeof(DataBoxHeavyJobSecretsTypeConverter))] + public partial interface IDataBoxHeavyJobSecrets + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.TypeConverter.cs new file mode 100644 index 00000000000..59152cc78f6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxHeavyJobSecretsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobSecrets ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobSecrets).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxHeavyJobSecrets.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxHeavyJobSecrets.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxHeavyJobSecrets.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.cs new file mode 100644 index 00000000000..66507777393 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The secrets related to a databox heavy job. + public partial class DataBoxHeavyJobSecrets : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobSecrets, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobSecretsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets __jobSecrets = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecrets(); + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).AdditionalInfo; } + + /// Backing field for property. + private System.Collections.Generic.List _cabinetPodSecret; + + /// Contains the list of secret objects for a databox heavy job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List CabinetPodSecret { get => this._cabinetPodSecret; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Code; } + + /// Dc Access Security Code for Customer Managed Shipping + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode DcAccessSecurityCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode = value ?? null /* model class */; } + + /// Forward Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DcAccessSecurityCodeForwardDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeForwardDcAccessCode; } + + /// Reverse Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DcAccessSecurityCodeReverseDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeReverseDcAccessCode; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Detail; } + + /// Error while fetching the secrets. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error = value ?? null /* model class */; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Message; } + + /// Internal Acessors for CabinetPodSecret + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobSecretsInternal.CabinetPodSecret { get => this._cabinetPodSecret; set { {_cabinetPodSecret = value;} } } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Code = value ?? null; } + + /// Internal Acessors for DcAccessSecurityCode + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode = value ?? null /* model class */; } + + /// Internal Acessors for DcAccessSecurityCodeForwardDcAccessCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCodeForwardDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeForwardDcAccessCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeForwardDcAccessCode = value ?? null; } + + /// Internal Acessors for DcAccessSecurityCodeReverseDcAccessCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCodeReverseDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeReverseDcAccessCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeReverseDcAccessCode = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error = value ?? null /* model class */; } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Target = value ?? null; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Target; } + + /// Used to indicate what type of job secrets object. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => "DataBoxHeavy"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Type = "DataBoxHeavy"; } + + /// Creates an new instance. + public DataBoxHeavyJobSecrets() + { + this.__jobSecrets.Type = "DataBoxHeavy"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobSecrets), __jobSecrets); + await eventListener.AssertObjectIsValid(nameof(__jobSecrets), __jobSecrets); + } + } + /// The secrets related to a databox heavy job. + public partial interface IDataBoxHeavyJobSecrets : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets + { + /// Contains the list of secret objects for a databox heavy job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Contains the list of secret objects for a databox heavy job.", + SerializedName = @"cabinetPodSecrets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecret) })] + System.Collections.Generic.List CabinetPodSecret { get; } + + } + /// The secrets related to a databox heavy job. + internal partial interface IDataBoxHeavyJobSecretsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal + { + /// Contains the list of secret objects for a databox heavy job. + System.Collections.Generic.List CabinetPodSecret { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.json.cs new file mode 100644 index 00000000000..b8e14c7243c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavyJobSecrets.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The secrets related to a databox heavy job. + public partial class DataBoxHeavyJobSecrets + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxHeavyJobSecrets(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobSecrets = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecrets(json); + {_cabinetPodSecret = If( json?.PropertyT("cabinetPodSecrets"), out var __jsonCabinetPodSecrets) ? If( __jsonCabinetPodSecrets as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDataBoxHeavySecret) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxHeavySecret.FromJson(__u) )) ))() : null : _cabinetPodSecret;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobSecrets. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobSecrets. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobSecrets FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxHeavyJobSecrets(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobSecrets?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._cabinetPodSecret) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._cabinetPodSecret ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("cabinetPodSecrets",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.PowerShell.cs new file mode 100644 index 00000000000..ab738dc6243 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.PowerShell.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The secrets related to a databox heavy. + [System.ComponentModel.TypeConverter(typeof(DataBoxHeavySecretTypeConverter))] + public partial class DataBoxHeavySecret + { + + /// + /// 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 DataBoxHeavySecret(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeviceSerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).DeviceSerialNumber = (string) content.GetValueForProperty("DeviceSerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).DeviceSerialNumber, global::System.Convert.ToString); + } + if (content.Contains("DevicePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).DevicePassword = (string) content.GetValueForProperty("DevicePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).DevicePassword, global::System.Convert.ToString); + } + if (content.Contains("NetworkConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).NetworkConfiguration = (System.Collections.Generic.List) content.GetValueForProperty("NetworkConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).NetworkConfiguration, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApplianceNetworkConfigurationTypeConverter.ConvertFrom)); + } + if (content.Contains("EncodedValidationCertPubKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).EncodedValidationCertPubKey = (string) content.GetValueForProperty("EncodedValidationCertPubKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).EncodedValidationCertPubKey, global::System.Convert.ToString); + } + if (content.Contains("AccountCredentialDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).AccountCredentialDetail = (System.Collections.Generic.List) content.GetValueForProperty("AccountCredentialDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).AccountCredentialDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AccountCredentialDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DataBoxHeavySecret(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeviceSerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).DeviceSerialNumber = (string) content.GetValueForProperty("DeviceSerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).DeviceSerialNumber, global::System.Convert.ToString); + } + if (content.Contains("DevicePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).DevicePassword = (string) content.GetValueForProperty("DevicePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).DevicePassword, global::System.Convert.ToString); + } + if (content.Contains("NetworkConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).NetworkConfiguration = (System.Collections.Generic.List) content.GetValueForProperty("NetworkConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).NetworkConfiguration, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApplianceNetworkConfigurationTypeConverter.ConvertFrom)); + } + if (content.Contains("EncodedValidationCertPubKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).EncodedValidationCertPubKey = (string) content.GetValueForProperty("EncodedValidationCertPubKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).EncodedValidationCertPubKey, global::System.Convert.ToString); + } + if (content.Contains("AccountCredentialDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).AccountCredentialDetail = (System.Collections.Generic.List) content.GetValueForProperty("AccountCredentialDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal)this).AccountCredentialDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AccountCredentialDetailsTypeConverter.ConvertFrom)); + } + 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.DataBox.Models.IDataBoxHeavySecret DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxHeavySecret(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.DataBox.Models.IDataBoxHeavySecret DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxHeavySecret(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.DataBox.Models.IDataBoxHeavySecret FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 secrets related to a databox heavy. + [System.ComponentModel.TypeConverter(typeof(DataBoxHeavySecretTypeConverter))] + public partial interface IDataBoxHeavySecret + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.TypeConverter.cs new file mode 100644 index 00000000000..4a0e47d3161 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxHeavySecretTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecret ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecret).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxHeavySecret.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxHeavySecret.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxHeavySecret.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.cs new file mode 100644 index 00000000000..93f549c01c6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The secrets related to a databox heavy. + public partial class DataBoxHeavySecret : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecret, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _accountCredentialDetail; + + /// Per account level access credentials. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List AccountCredentialDetail { get => this._accountCredentialDetail; } + + /// Backing field for property. + private string _devicePassword; + + /// Password for out of the box experience on device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DevicePassword { get => this._devicePassword; } + + /// Backing field for property. + private string _deviceSerialNumber; + + /// Serial number of the assigned device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DeviceSerialNumber { get => this._deviceSerialNumber; } + + /// Backing field for property. + private string _encodedValidationCertPubKey; + + /// The base 64 encoded public key to authenticate with the device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string EncodedValidationCertPubKey { get => this._encodedValidationCertPubKey; } + + /// Internal Acessors for AccountCredentialDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal.AccountCredentialDetail { get => this._accountCredentialDetail; set { {_accountCredentialDetail = value;} } } + + /// Internal Acessors for DevicePassword + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal.DevicePassword { get => this._devicePassword; set { {_devicePassword = value;} } } + + /// Internal Acessors for DeviceSerialNumber + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal.DeviceSerialNumber { get => this._deviceSerialNumber; set { {_deviceSerialNumber = value;} } } + + /// Internal Acessors for EncodedValidationCertPubKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal.EncodedValidationCertPubKey { get => this._encodedValidationCertPubKey; set { {_encodedValidationCertPubKey = value;} } } + + /// Internal Acessors for NetworkConfiguration + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecretInternal.NetworkConfiguration { get => this._networkConfiguration; set { {_networkConfiguration = value;} } } + + /// Backing field for property. + private System.Collections.Generic.List _networkConfiguration; + + /// Network configuration of the appliance. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List NetworkConfiguration { get => this._networkConfiguration; } + + /// Creates an new instance. + public DataBoxHeavySecret() + { + + } + } + /// The secrets related to a databox heavy. + public partial interface IDataBoxHeavySecret : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Per account level access credentials. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Per account level access credentials.", + SerializedName = @"accountCredentialDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetails) })] + System.Collections.Generic.List AccountCredentialDetail { get; } + /// Password for out of the box experience on device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Password for out of the box experience on device.", + SerializedName = @"devicePassword", + PossibleTypes = new [] { typeof(string) })] + string DevicePassword { get; } + /// Serial number of the assigned device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Serial number of the assigned device.", + SerializedName = @"deviceSerialNumber", + PossibleTypes = new [] { typeof(string) })] + string DeviceSerialNumber { get; } + /// The base 64 encoded public key to authenticate with the device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The base 64 encoded public key to authenticate with the device", + SerializedName = @"encodedValidationCertPubKey", + PossibleTypes = new [] { typeof(string) })] + string EncodedValidationCertPubKey { get; } + /// Network configuration of the appliance. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Network configuration of the appliance.", + SerializedName = @"networkConfigurations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfiguration) })] + System.Collections.Generic.List NetworkConfiguration { get; } + + } + /// The secrets related to a databox heavy. + internal partial interface IDataBoxHeavySecretInternal + + { + /// Per account level access credentials. + System.Collections.Generic.List AccountCredentialDetail { get; set; } + /// Password for out of the box experience on device. + string DevicePassword { get; set; } + /// Serial number of the assigned device. + string DeviceSerialNumber { get; set; } + /// The base 64 encoded public key to authenticate with the device + string EncodedValidationCertPubKey { get; set; } + /// Network configuration of the appliance. + System.Collections.Generic.List NetworkConfiguration { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.json.cs new file mode 100644 index 00000000000..40f7d75bbe3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxHeavySecret.json.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The secrets related to a databox heavy. + public partial class DataBoxHeavySecret + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxHeavySecret(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_deviceSerialNumber = If( json?.PropertyT("deviceSerialNumber"), out var __jsonDeviceSerialNumber) ? (string)__jsonDeviceSerialNumber : (string)_deviceSerialNumber;} + {_devicePassword = If( json?.PropertyT("devicePassword"), out var __jsonDevicePassword) ? (string)__jsonDevicePassword : (string)_devicePassword;} + {_networkConfiguration = If( json?.PropertyT("networkConfigurations"), out var __jsonNetworkConfigurations) ? If( __jsonNetworkConfigurations as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApplianceNetworkConfiguration) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApplianceNetworkConfiguration.FromJson(__u) )) ))() : null : _networkConfiguration;} + {_encodedValidationCertPubKey = If( json?.PropertyT("encodedValidationCertPubKey"), out var __jsonEncodedValidationCertPubKey) ? (string)__jsonEncodedValidationCertPubKey : (string)_encodedValidationCertPubKey;} + {_accountCredentialDetail = If( json?.PropertyT("accountCredentialDetails"), out var __jsonAccountCredentialDetails) ? If( __jsonAccountCredentialDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IAccountCredentialDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AccountCredentialDetails.FromJson(__p) )) ))() : null : _accountCredentialDetail;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecret. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecret. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavySecret FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxHeavySecret(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._deviceSerialNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._deviceSerialNumber.ToString()) : null, "deviceSerialNumber" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._devicePassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._devicePassword.ToString()) : null, "devicePassword" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._networkConfiguration) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._networkConfiguration ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("networkConfigurations",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._encodedValidationCertPubKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._encodedValidationCertPubKey.ToString()) : null, "encodedValidationCertPubKey" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._accountCredentialDetail) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __s in this._accountCredentialDetail ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("accountCredentialDetails",__r); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.PowerShell.cs new file mode 100644 index 00000000000..31d8a9d6e22 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.PowerShell.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(DataBoxIdentityTypeConverter))] + public partial class DataBoxIdentity + { + + /// + /// 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 DataBoxIdentity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("ResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("JobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).JobName, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).Id, 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 DataBoxIdentity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("ResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("JobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).JobName, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal)this).Id, 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.DataBox.Models.IDataBoxIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxIdentity(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.DataBox.Models.IDataBoxIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxIdentity(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.DataBox.Models.IDataBoxIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(DataBoxIdentityTypeConverter))] + public partial interface IDataBoxIdentity + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.TypeConverter.cs new file mode 100644 index 00000000000..1434f1fba41 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.TypeConverter.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxIdentityTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + // we allow string conversion too. + if (type == typeof(global::System.String)) + { + return true; + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + // support direct string to id type conversion. + if (type == typeof(global::System.String)) + { + return new DataBoxIdentity { Id = sourceValue }; + } + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxIdentity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxIdentity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxIdentity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.cs new file mode 100644 index 00000000000..f318d77bddd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class DataBoxIdentity : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentityInternal + { + + /// Backing field for property. + private string _id; + + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private string _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Creates an new instance. + public DataBoxIdentity() + { + + } + } + public partial interface IDataBoxIdentity : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Resource identity path", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + string JobName { get; set; } + /// The name of the Azure region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// The name of the resource group. The name is case insensitive. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.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) })] + string ResourceGroupName { get; set; } + /// The ID of the target subscription. The value must be an UUID. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; set; } + + } + internal partial interface IDataBoxIdentityInternal + + { + /// Resource identity path + string Id { get; set; } + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + string JobName { get; set; } + /// The name of the Azure region. + string Location { get; set; } + /// The name of the resource group. The name is case insensitive. + string ResourceGroupName { get; set; } + /// The ID of the target subscription. The value must be an UUID. + string SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.json.cs new file mode 100644 index 00000000000..ef6da26bb87 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxIdentity.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class DataBoxIdentity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxIdentity(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + 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;} + {_jobName = If( json?.PropertyT("jobName"), out var __jsonJobName) ? (string)__jsonJobName : (string)_jobName;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)_location;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxIdentity(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AddIf( null != (((object)this._resourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._resourceGroupName.ToString()) : null, "resourceGroupName" ,container.Add ); + AddIf( null != (((object)this._jobName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._jobName.ToString()) : null, "jobName" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.PowerShell.cs new file mode 100644 index 00000000000..50a2a431230 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.PowerShell.cs @@ -0,0 +1,890 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Databox Job Details + [System.ComponentModel.TypeConverter(typeof(DataBoxJobDetailsTypeConverter))] + public partial class DataBoxJobDetails + { + + /// + /// 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 DataBoxJobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CopyProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetailsInternal)this).CopyProgress = (System.Collections.Generic.List) content.GetValueForProperty("CopyProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetailsInternal)this).CopyProgress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyProgressTypeConverter.ConvertFrom)); + } + if (content.Contains("DevicePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetailsInternal)this).DevicePassword = (string) content.GetValueForProperty("DevicePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetailsInternal)this).DevicePassword, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailEmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailEmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContactDetailNotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailNotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ReverseShippingDetailShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyIdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("KeyEncryptionKeyIdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyKekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType = (string) content.GetValueForProperty("KeyEncryptionKeyKekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName = (string) content.GetValueForProperty("ContactDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone = (string) content.GetValueForProperty("ContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension = (string) content.GetValueForProperty("ContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile = (string) content.GetValueForProperty("ContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl = (string) content.GetValueForProperty("DeliveryPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId = (string) content.GetValueForProperty("DeliveryPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl = (string) content.GetValueForProperty("ReturnPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId = (string) content.GetValueForProperty("ReturnPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ReverseShippingDetailContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated = (bool?) content.GetValueForProperty("ReverseShippingDetailIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailDeviceErasureStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus = (string) content.GetValueForProperty("DeviceErasureDetailDeviceErasureStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailErasureOrDestructionCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailErasureOrDestructionCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailSecureErasureCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailSecureErasureCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl = (string) content.GetValueForProperty("KeyEncryptionKeyKekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId = (string) content.GetValueForProperty("KeyEncryptionKeyKekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("LastMitigationActionOnJobActionDateTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastMitigationActionOnJobActionDateTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMitigationActionOnJobIsPerformedByCustomer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer = (bool?) content.GetValueForProperty("LastMitigationActionOnJobIsPerformedByCustomer",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastMitigationActionOnJobCustomerResolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution = (string) content.GetValueForProperty("LastMitigationActionOnJobCustomerResolution",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressSupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("DatacenterAddressSupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DatacenterAddressDataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation = (string) content.GetValueForProperty("DatacenterAddressDataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName = (string) content.GetValueForProperty("ReverseShippingDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ReverseShippingDetailsShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId, global::System.Convert.ToString); + } + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails) content.GetValueForProperty("ReverseShippingDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceErasureDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails) content.GetValueForProperty("DeviceErasureDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey) content.GetValueForProperty("KeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKeyTypeConverter.ConvertFrom); + } + if (content.Contains("LastMitigationActionOnJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob) content.GetValueForProperty("LastMitigationActionOnJob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJobTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse) content.GetValueForProperty("DatacenterAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponseTypeConverter.ConvertFrom); + } + if (content.Contains("JobStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage = (System.Collections.Generic.List) content.GetValueForProperty("JobStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobStagesTypeConverter.ConvertFrom)); + } + if (content.Contains("DataImportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataImportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DataExportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataExportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CopyLogDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail = (System.Collections.Generic.List) content.GetValueForProperty("CopyLogDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReverseShipmentLabelSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey = (string) content.GetValueForProperty("ReverseShipmentLabelSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey, global::System.Convert.ToString); + } + if (content.Contains("ChainOfCustodySasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey = (string) content.GetValueForProperty("ChainOfCustodySasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey, global::System.Convert.ToString); + } + if (content.Contains("ExpectedDataSizeInTeraByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte = (int?) content.GetValueForProperty("ExpectedDataSizeInTeraByte",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode = (string) content.GetValueForProperty("DataCenterCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode, 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 DataBoxJobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CopyProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetailsInternal)this).CopyProgress = (System.Collections.Generic.List) content.GetValueForProperty("CopyProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetailsInternal)this).CopyProgress, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyProgressTypeConverter.ConvertFrom)); + } + if (content.Contains("DevicePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetailsInternal)this).DevicePassword = (string) content.GetValueForProperty("DevicePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetailsInternal)this).DevicePassword, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailEmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailEmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContactDetailNotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailNotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ReverseShippingDetailShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyIdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("KeyEncryptionKeyIdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyKekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType = (string) content.GetValueForProperty("KeyEncryptionKeyKekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName = (string) content.GetValueForProperty("ContactDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone = (string) content.GetValueForProperty("ContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension = (string) content.GetValueForProperty("ContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile = (string) content.GetValueForProperty("ContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl = (string) content.GetValueForProperty("DeliveryPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId = (string) content.GetValueForProperty("DeliveryPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl = (string) content.GetValueForProperty("ReturnPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId = (string) content.GetValueForProperty("ReturnPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ReverseShippingDetailContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated = (bool?) content.GetValueForProperty("ReverseShippingDetailIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailDeviceErasureStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus = (string) content.GetValueForProperty("DeviceErasureDetailDeviceErasureStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailErasureOrDestructionCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailErasureOrDestructionCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailSecureErasureCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailSecureErasureCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl = (string) content.GetValueForProperty("KeyEncryptionKeyKekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId = (string) content.GetValueForProperty("KeyEncryptionKeyKekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("LastMitigationActionOnJobActionDateTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastMitigationActionOnJobActionDateTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMitigationActionOnJobIsPerformedByCustomer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer = (bool?) content.GetValueForProperty("LastMitigationActionOnJobIsPerformedByCustomer",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastMitigationActionOnJobCustomerResolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution = (string) content.GetValueForProperty("LastMitigationActionOnJobCustomerResolution",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressSupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("DatacenterAddressSupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DatacenterAddressDataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation = (string) content.GetValueForProperty("DatacenterAddressDataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName = (string) content.GetValueForProperty("ReverseShippingDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ReverseShippingDetailsShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId, global::System.Convert.ToString); + } + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails) content.GetValueForProperty("ReverseShippingDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceErasureDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails) content.GetValueForProperty("DeviceErasureDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey) content.GetValueForProperty("KeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKeyTypeConverter.ConvertFrom); + } + if (content.Contains("LastMitigationActionOnJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob) content.GetValueForProperty("LastMitigationActionOnJob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJobTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse) content.GetValueForProperty("DatacenterAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponseTypeConverter.ConvertFrom); + } + if (content.Contains("JobStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage = (System.Collections.Generic.List) content.GetValueForProperty("JobStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobStagesTypeConverter.ConvertFrom)); + } + if (content.Contains("DataImportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataImportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DataExportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataExportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CopyLogDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail = (System.Collections.Generic.List) content.GetValueForProperty("CopyLogDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReverseShipmentLabelSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey = (string) content.GetValueForProperty("ReverseShipmentLabelSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey, global::System.Convert.ToString); + } + if (content.Contains("ChainOfCustodySasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey = (string) content.GetValueForProperty("ChainOfCustodySasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey, global::System.Convert.ToString); + } + if (content.Contains("ExpectedDataSizeInTeraByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte = (int?) content.GetValueForProperty("ExpectedDataSizeInTeraByte",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode = (string) content.GetValueForProperty("DataCenterCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode, 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.DataBox.Models.IDataBoxJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxJobDetails(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.DataBox.Models.IDataBoxJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxJobDetails(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.DataBox.Models.IDataBoxJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Databox Job Details + [System.ComponentModel.TypeConverter(typeof(DataBoxJobDetailsTypeConverter))] + public partial interface IDataBoxJobDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.TypeConverter.cs new file mode 100644 index 00000000000..48a3a5259b6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxJobDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxJobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxJobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxJobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.cs new file mode 100644 index 00000000000..93e289e8459 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Databox Job Details + public partial class DataBoxJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetails(); + + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Action; } + + /// Shared access key to download the chain of custody logs + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ChainOfCustodySasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ChainOfCustodySasKey; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string City { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).City = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string CompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CompanyName = value ?? null; } + + /// Contact details for notification and shipping. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails ContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail = value ?? null /* model class */; } + + /// List of Email-ids to be notified about job progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List ContactDetailEmailList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailEmailList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailEmailList = value ; } + + /// Notification preference for a job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List ContactDetailNotificationPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailNotificationPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailNotificationPreference = value ?? null /* arrayOf */; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsContactName = value ; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsMobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsMobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhone = value ; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ContactDetailsPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetailsPhoneExtension = value ?? null; } + + /// List of copy log details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List CopyLogDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CopyLogDetail; } + + /// Backing field for property. + private System.Collections.Generic.List _copyProgress; + + /// Copy progress per storage account. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List CopyProgress { get => this._copyProgress; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Country { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Country = value ?? null; } + + /// DataCenter code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DataCenterCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataCenterCode; } + + /// Details of the data to be exported from azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List DataExportDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataExportDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataExportDetail = value ?? null /* arrayOf */; } + + /// Details of the data to be imported into azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List DataImportDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataImportDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataImportDetail = value ?? null /* arrayOf */; } + + /// Datacenter address to ship to, for the given sku and storage location. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse DatacenterAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress = value ?? null /* model class */; } + + /// Azure Location where the Data Center serves primarily. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DatacenterAddressDataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressDataCenterAzureLocation; } + + /// List of supported carriers for return shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List DatacenterAddressSupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressSupportedCarriersForReturnShipment; } + + /// Data center address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DatacenterAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressType; } + + /// Delivery package shipping details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails DeliveryPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage = value ?? null /* model class */; } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageCarrierName; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeliveryPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingId; } + + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeliveryPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingUrl; } + + /// Holds device data erasure details + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails DeviceErasureDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail = value ?? null /* model class */; } + + /// Holds the device erasure completion status + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeviceErasureDetailDeviceErasureStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailDeviceErasureStatus; } + + /// Shared access key to download cleanup or destruction certificate for device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeviceErasureDetailErasureOrDestructionCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailErasureOrDestructionCertificateSasKey; } + + /// Shared access key to download secure erasure certificate for the device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DeviceErasureDetailSecureErasureCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailSecureErasureCertificateSasKey; } + + /// Backing field for property. + private string _devicePassword; + + /// + /// Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not + /// passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password + /// must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and + /// one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers + /// and these characters : @#\-$%^!+=;:_()]+ + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DevicePassword { get => this._devicePassword; set => this._devicePassword = value; } + + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string EncryptionPreferenceDoubleEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceDoubleEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceDoubleEncryption = value ?? null; } + + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string EncryptionPreferenceHardwareEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceHardwareEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).EncryptionPreferenceHardwareEncryption = value ?? null; } + + /// + /// The expected size of the data, which needs to be transferred in this job, in terabytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public int? ExpectedDataSizeInTeraByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ExpectedDataSizeInTeraByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ExpectedDataSizeInTeraByte = value ?? default(int); } + + /// Managed service identity type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string IdentityPropertyType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyType = value ?? null; } + + /// User assigned identity properties. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties IdentityPropertyUserAssigned { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned = value ?? null /* model class */; } + + /// List of stages that run in the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List JobStage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).JobStage; } + + /// Details about which key encryption type is being used. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey KeyEncryptionKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey = value ?? null /* model class */; } + + /// Managed identity properties used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties KeyEncryptionKeyIdentityProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty = value ?? null /* model class */; } + + /// Type of encryption key used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string KeyEncryptionKeyKekType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekType = value ?? null; } + + /// Key encryption key. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string KeyEncryptionKeyKekUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekUrl = value ?? null; } + + /// Kek vault resource id. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string KeyEncryptionKeyKekVaultResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekVaultResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyKekVaultResourceId = value ?? null; } + + /// Last mitigation action performed on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob LastMitigationActionOnJob { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob = value ?? null /* model class */; } + + /// Action performed date time + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public global::System.DateTime? LastMitigationActionOnJobActionDateTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobActionDateTimeInUtc; } + + /// Resolution code provided by customer + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string LastMitigationActionOnJobCustomerResolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobCustomerResolution; } + + /// + /// Action performed by customer, + /// possibility is that mitigation might happen by customer or service or by ops + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? LastMitigationActionOnJobIsPerformedByCustomer { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobIsPerformedByCustomer; } + + /// Internal Acessors for CopyProgress + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetailsInternal.CopyProgress { get => this._copyProgress; set { {_copyProgress = value;} } } + + /// Internal Acessors for Action + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Action; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Action = value ?? null /* arrayOf */; } + + /// Internal Acessors for ChainOfCustodySasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ChainOfCustodySasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ChainOfCustodySasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ChainOfCustodySasKey = value ?? null; } + + /// Internal Acessors for ContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ContactDetail = value ?? null /* model class */; } + + /// Internal Acessors for CopyLogDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.CopyLogDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CopyLogDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).CopyLogDetail = value ?? null /* arrayOf */; } + + /// Internal Acessors for DataCenterCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DataCenterCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataCenterCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DataCenterCode = value ?? null; } + + /// Internal Acessors for DatacenterAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddress = value ?? null /* model class */; } + + /// Internal Acessors for DatacenterAddressDataCenterAzureLocation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressDataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressDataCenterAzureLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressDataCenterAzureLocation = value ?? null; } + + /// Internal Acessors for DatacenterAddressSupportedCarriersForReturnShipment + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressSupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressSupportedCarriersForReturnShipment; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressSupportedCarriersForReturnShipment = value ?? null /* arrayOf */; } + + /// Internal Acessors for DatacenterAddressType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DatacenterAddressType = value ?? null; } + + /// Internal Acessors for DeliveryPackage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackage = value ?? null /* model class */; } + + /// Internal Acessors for DeliveryPackageCarrierName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageCarrierName = value ?? null; } + + /// Internal Acessors for DeliveryPackageTrackingId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingId = value ?? null; } + + /// Internal Acessors for DeliveryPackageTrackingUrl + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeliveryPackageTrackingUrl = value ?? null; } + + /// Internal Acessors for DeviceErasureDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetail = value ?? null /* model class */; } + + /// Internal Acessors for DeviceErasureDetailDeviceErasureStatus + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailDeviceErasureStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailDeviceErasureStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailDeviceErasureStatus = value ?? null; } + + /// Internal Acessors for DeviceErasureDetailErasureOrDestructionCertificateSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailErasureOrDestructionCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailErasureOrDestructionCertificateSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailErasureOrDestructionCertificateSasKey = value ?? null; } + + /// Internal Acessors for DeviceErasureDetailSecureErasureCertificateSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailSecureErasureCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailSecureErasureCertificateSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).DeviceErasureDetailSecureErasureCertificateSasKey = value ?? null; } + + /// Internal Acessors for IdentityPropertyUserAssigned + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.IdentityPropertyUserAssigned { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).IdentityPropertyUserAssigned = value ?? null /* model class */; } + + /// Internal Acessors for JobStage + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.JobStage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).JobStage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).JobStage = value ?? null /* arrayOf */; } + + /// Internal Acessors for KeyEncryptionKey + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.KeyEncryptionKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKey = value ?? null /* model class */; } + + /// Internal Acessors for KeyEncryptionKeyIdentityProperty + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.KeyEncryptionKeyIdentityProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).KeyEncryptionKeyIdentityProperty = value ?? null /* model class */; } + + /// Internal Acessors for LastMitigationActionOnJob + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJob { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJob = value ?? null /* model class */; } + + /// Internal Acessors for LastMitigationActionOnJobActionDateTimeInUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobActionDateTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobActionDateTimeInUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobActionDateTimeInUtc = value ?? default(global::System.DateTime); } + + /// Internal Acessors for LastMitigationActionOnJobCustomerResolution + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobCustomerResolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobCustomerResolution; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobCustomerResolution = value ?? null; } + + /// Internal Acessors for LastMitigationActionOnJobIsPerformedByCustomer + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobIsPerformedByCustomer { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobIsPerformedByCustomer; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).LastMitigationActionOnJobIsPerformedByCustomer = value ?? default(bool); } + + /// Internal Acessors for Preference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.Preference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceEncryptionPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceEncryptionPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceReverseTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceReverseTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for ReturnPackage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage = value ?? null /* model class */; } + + /// Internal Acessors for ReturnPackageCarrierName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageCarrierName = value ?? null; } + + /// Internal Acessors for ReturnPackageTrackingId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingId = value ?? null; } + + /// Internal Acessors for ReturnPackageTrackingUrl + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingUrl = value ?? null; } + + /// Internal Acessors for ReverseShipmentLabelSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShipmentLabelSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShipmentLabelSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShipmentLabelSasKey = value ?? null; } + + /// Internal Acessors for ReverseShippingDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail = value ?? null /* model class */; } + + /// Internal Acessors for ReverseShippingDetailContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail = value ?? null /* model class */; } + + /// Internal Acessors for ReverseShippingDetailIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailIsUpdated = value ?? default(bool); } + + /// Internal Acessors for ReverseShippingDetailShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress = value ?? null /* model class */; } + + /// Internal Acessors for ReverseTransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferenceIsUpdated = value ?? default(bool); } + + /// Internal Acessors for ShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress = value ?? null /* model class */; } + + /// Internal Acessors for TransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferenceIsUpdated = value ?? default(bool); } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string PostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PostalCode = value ?? null; } + + /// Preferences for the order. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Preference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Preference = value ?? null /* model class */; } + + /// Preferences related to the Encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences PreferenceEncryptionPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceEncryptionPreference = value ?? null /* model class */; } + + /// Preferred data center region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List PreferencePreferredDataCenterRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferencePreferredDataCenterRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferencePreferredDataCenterRegion = value ?? null /* arrayOf */; } + + /// Optional Preferences related to the reverse shipment logistics of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceReverseTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceReverseTransportPreference = value ?? null /* model class */; } + + /// Preferences related to the Access Tier of storage accounts. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceStorageAccountAccessTierPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceStorageAccountAccessTierPreference = value ?? null /* arrayOf */; } + + /// Preferences related to the shipment logistics of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).PreferenceTransportPreference = value ?? null /* model class */; } + + /// Return package shipping details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails ReturnPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackage = value ?? null /* model class */; } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageCarrierName; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReturnPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingId; } + + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReturnPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReturnPackageTrackingUrl; } + + /// Shared access key to download the return shipment label + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShipmentLabelSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShipmentLabelSasKey; } + + /// Optional Reverse Shipping details for order. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails ReverseShippingDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetail = value ?? null /* model class */; } + + /// Contact Info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo ReverseShippingDetailContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailContactDetail = value ?? null /* model class */; } + + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? ReverseShippingDetailIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailIsUpdated; } + + /// Shipping address where customer wishes to receive the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ReverseShippingDetailShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailShippingAddress = value ?? null /* model class */; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactDetailsMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsMobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsMobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactDetailsPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhone = value ?? null; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactDetailsPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactDetailsPhoneExtension = value ?? null; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsContactName = value ?? null; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCity = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressCompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCompanyName = value ?? null; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressCountry { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCountry; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressCountry = value ?? null; } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressPostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressPostalCode = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? ReverseShippingDetailsShippingAddressSkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressSkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressSkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressStreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressStreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressTaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressTaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = value ?? null; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressType = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseShippingDetailsShippingAddressZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseShippingDetailsShippingAddressZipExtendedCode = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ReverseTransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ReverseTransportPreferencePreferredShipmentType = value ?? null; } + + /// Shipping address of the customer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddress = value ?? null /* model class */; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ShippingAddressType = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? SkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).SkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).SkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).StreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string TaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TaxIdentificationNumber = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public bool? TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string TransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).TransportPreferencePreferredShipmentType = value ?? null; } + + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => "DataBox"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).Type = "DataBox"; } + + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string UserAssignedResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).UserAssignedResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).UserAssignedResourceId = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)__jobDetails).ZipExtendedCode = value ?? null; } + + /// Creates an new instance. + public DataBoxJobDetails() + { + this.__jobDetails.Type = "DataBox"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobDetails), __jobDetails); + await eventListener.AssertObjectIsValid(nameof(__jobDetails), __jobDetails); + } + } + /// Databox Job Details + public partial interface IDataBoxJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails + { + /// Copy progress per storage account. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Copy progress per storage account.", + SerializedName = @"copyProgress", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyProgress) })] + System.Collections.Generic.List CopyProgress { get; } + /// + /// Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not + /// passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password + /// must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and + /// one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers + /// and these characters : @#\-$%^!+=;:_()]+ + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+", + SerializedName = @"devicePassword", + PossibleTypes = new [] { typeof(string) })] + string DevicePassword { get; set; } + + } + /// Databox Job Details + internal partial interface IDataBoxJobDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal + { + /// Copy progress per storage account. + System.Collections.Generic.List CopyProgress { get; set; } + /// + /// Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not + /// passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password + /// must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and + /// one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers + /// and these characters : @#\-$%^!+=;:_()]+ + /// + string DevicePassword { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.json.cs new file mode 100644 index 00000000000..3ee537100fd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxJobDetails.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Databox Job Details + public partial class DataBoxJobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxJobDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetails(json); + {_copyProgress = If( json?.PropertyT("copyProgress"), out var __jsonCopyProgress) ? If( __jsonCopyProgress as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.ICopyProgress) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyProgress.FromJson(__u) )) ))() : null : _copyProgress;} + {_devicePassword = If( json?.PropertyT("devicePassword"), out var __jsonDevicePassword) ? (string)__jsonDevicePassword : (string)_devicePassword;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxJobDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._copyProgress) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._copyProgress ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("copyProgress",__w); + } + } + AddIf( null != (((object)this._devicePassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._devicePassword.ToString()) : null, "devicePassword" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.PowerShell.cs new file mode 100644 index 00000000000..36fbe09928f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request body to get the availability for scheduling data box orders orders. + [System.ComponentModel.TypeConverter(typeof(DataBoxScheduleAvailabilityRequestTypeConverter))] + public partial class DataBoxScheduleAvailabilityRequest + { + + /// + /// 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 DataBoxScheduleAvailabilityRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation = (string) content.GetValueForProperty("StorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model, 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 DataBoxScheduleAvailabilityRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation = (string) content.GetValueForProperty("StorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model, 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.DataBox.Models.IDataBoxScheduleAvailabilityRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxScheduleAvailabilityRequest(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.DataBox.Models.IDataBoxScheduleAvailabilityRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxScheduleAvailabilityRequest(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.DataBox.Models.IDataBoxScheduleAvailabilityRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Request body to get the availability for scheduling data box orders orders. + [System.ComponentModel.TypeConverter(typeof(DataBoxScheduleAvailabilityRequestTypeConverter))] + public partial interface IDataBoxScheduleAvailabilityRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.TypeConverter.cs new file mode 100644 index 00000000000..bdf1aefca49 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxScheduleAvailabilityRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxScheduleAvailabilityRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxScheduleAvailabilityRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxScheduleAvailabilityRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxScheduleAvailabilityRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxScheduleAvailabilityRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.cs new file mode 100644 index 00000000000..88c798fef8f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the availability for scheduling data box orders orders. + public partial class DataBoxScheduleAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxScheduleAvailabilityRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxScheduleAvailabilityRequestInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest __scheduleAvailabilityRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityRequest(); + + /// Country in which storage location should be supported. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Country { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).Country = value ?? null; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Model { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).Model; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).Model = value ?? null; } + + /// Sku Name for which the order is to be scheduled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string SkuName { get => "DataBox"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).SkuName = "DataBox"; } + + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StorageLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).StorageLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).StorageLocation = value ; } + + /// Creates an new instance. + public DataBoxScheduleAvailabilityRequest() + { + this.__scheduleAvailabilityRequest.SkuName = "DataBox"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__scheduleAvailabilityRequest), __scheduleAvailabilityRequest); + await eventListener.AssertObjectIsValid(nameof(__scheduleAvailabilityRequest), __scheduleAvailabilityRequest); + } + } + /// Request body to get the availability for scheduling data box orders orders. + public partial interface IDataBoxScheduleAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest + { + + } + /// Request body to get the availability for scheduling data box orders orders. + internal partial interface IDataBoxScheduleAvailabilityRequestInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.json.cs new file mode 100644 index 00000000000..9559e0b2ef2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxScheduleAvailabilityRequest.json.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the availability for scheduling data box orders orders. + public partial class DataBoxScheduleAvailabilityRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxScheduleAvailabilityRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __scheduleAvailabilityRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityRequest(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxScheduleAvailabilityRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxScheduleAvailabilityRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxScheduleAvailabilityRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxScheduleAvailabilityRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __scheduleAvailabilityRequest?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.PowerShell.cs new file mode 100644 index 00000000000..e3045737caf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.PowerShell.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The secrets related to a DataBox. + [System.ComponentModel.TypeConverter(typeof(DataBoxSecretTypeConverter))] + public partial class DataBoxSecret + { + + /// + /// 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 DataBoxSecret(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeviceSerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).DeviceSerialNumber = (string) content.GetValueForProperty("DeviceSerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).DeviceSerialNumber, global::System.Convert.ToString); + } + if (content.Contains("DevicePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).DevicePassword = (string) content.GetValueForProperty("DevicePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).DevicePassword, global::System.Convert.ToString); + } + if (content.Contains("NetworkConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).NetworkConfiguration = (System.Collections.Generic.List) content.GetValueForProperty("NetworkConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).NetworkConfiguration, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApplianceNetworkConfigurationTypeConverter.ConvertFrom)); + } + if (content.Contains("EncodedValidationCertPubKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).EncodedValidationCertPubKey = (string) content.GetValueForProperty("EncodedValidationCertPubKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).EncodedValidationCertPubKey, global::System.Convert.ToString); + } + if (content.Contains("AccountCredentialDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).AccountCredentialDetail = (System.Collections.Generic.List) content.GetValueForProperty("AccountCredentialDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).AccountCredentialDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AccountCredentialDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DataBoxSecret(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeviceSerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).DeviceSerialNumber = (string) content.GetValueForProperty("DeviceSerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).DeviceSerialNumber, global::System.Convert.ToString); + } + if (content.Contains("DevicePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).DevicePassword = (string) content.GetValueForProperty("DevicePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).DevicePassword, global::System.Convert.ToString); + } + if (content.Contains("NetworkConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).NetworkConfiguration = (System.Collections.Generic.List) content.GetValueForProperty("NetworkConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).NetworkConfiguration, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApplianceNetworkConfigurationTypeConverter.ConvertFrom)); + } + if (content.Contains("EncodedValidationCertPubKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).EncodedValidationCertPubKey = (string) content.GetValueForProperty("EncodedValidationCertPubKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).EncodedValidationCertPubKey, global::System.Convert.ToString); + } + if (content.Contains("AccountCredentialDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).AccountCredentialDetail = (System.Collections.Generic.List) content.GetValueForProperty("AccountCredentialDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal)this).AccountCredentialDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AccountCredentialDetailsTypeConverter.ConvertFrom)); + } + 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.DataBox.Models.IDataBoxSecret DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataBoxSecret(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.DataBox.Models.IDataBoxSecret DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataBoxSecret(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.DataBox.Models.IDataBoxSecret FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 secrets related to a DataBox. + [System.ComponentModel.TypeConverter(typeof(DataBoxSecretTypeConverter))] + public partial interface IDataBoxSecret + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.TypeConverter.cs new file mode 100644 index 00000000000..c387d86fdfb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataBoxSecretTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecret ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecret).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataBoxSecret.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataBoxSecret.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataBoxSecret.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.cs new file mode 100644 index 00000000000..dcfb9e68ea6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The secrets related to a DataBox. + public partial class DataBoxSecret : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecret, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _accountCredentialDetail; + + /// Per account level access credentials. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List AccountCredentialDetail { get => this._accountCredentialDetail; } + + /// Backing field for property. + private string _devicePassword; + + /// Password for out of the box experience on device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DevicePassword { get => this._devicePassword; } + + /// Backing field for property. + private string _deviceSerialNumber; + + /// Serial number of the assigned device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DeviceSerialNumber { get => this._deviceSerialNumber; } + + /// Backing field for property. + private string _encodedValidationCertPubKey; + + /// The base 64 encoded public key to authenticate with the device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string EncodedValidationCertPubKey { get => this._encodedValidationCertPubKey; } + + /// Internal Acessors for AccountCredentialDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal.AccountCredentialDetail { get => this._accountCredentialDetail; set { {_accountCredentialDetail = value;} } } + + /// Internal Acessors for DevicePassword + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal.DevicePassword { get => this._devicePassword; set { {_devicePassword = value;} } } + + /// Internal Acessors for DeviceSerialNumber + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal.DeviceSerialNumber { get => this._deviceSerialNumber; set { {_deviceSerialNumber = value;} } } + + /// Internal Acessors for EncodedValidationCertPubKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal.EncodedValidationCertPubKey { get => this._encodedValidationCertPubKey; set { {_encodedValidationCertPubKey = value;} } } + + /// Internal Acessors for NetworkConfiguration + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecretInternal.NetworkConfiguration { get => this._networkConfiguration; set { {_networkConfiguration = value;} } } + + /// Backing field for property. + private System.Collections.Generic.List _networkConfiguration; + + /// Network configuration of the appliance. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List NetworkConfiguration { get => this._networkConfiguration; } + + /// Creates an new instance. + public DataBoxSecret() + { + + } + } + /// The secrets related to a DataBox. + public partial interface IDataBoxSecret : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Per account level access credentials. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Per account level access credentials.", + SerializedName = @"accountCredentialDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAccountCredentialDetails) })] + System.Collections.Generic.List AccountCredentialDetail { get; } + /// Password for out of the box experience on device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Password for out of the box experience on device.", + SerializedName = @"devicePassword", + PossibleTypes = new [] { typeof(string) })] + string DevicePassword { get; } + /// Serial number of the assigned device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Serial number of the assigned device.", + SerializedName = @"deviceSerialNumber", + PossibleTypes = new [] { typeof(string) })] + string DeviceSerialNumber { get; } + /// The base 64 encoded public key to authenticate with the device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The base 64 encoded public key to authenticate with the device", + SerializedName = @"encodedValidationCertPubKey", + PossibleTypes = new [] { typeof(string) })] + string EncodedValidationCertPubKey { get; } + /// Network configuration of the appliance. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Network configuration of the appliance.", + SerializedName = @"networkConfigurations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IApplianceNetworkConfiguration) })] + System.Collections.Generic.List NetworkConfiguration { get; } + + } + /// The secrets related to a DataBox. + internal partial interface IDataBoxSecretInternal + + { + /// Per account level access credentials. + System.Collections.Generic.List AccountCredentialDetail { get; set; } + /// Password for out of the box experience on device. + string DevicePassword { get; set; } + /// Serial number of the assigned device. + string DeviceSerialNumber { get; set; } + /// The base 64 encoded public key to authenticate with the device + string EncodedValidationCertPubKey { get; set; } + /// Network configuration of the appliance. + System.Collections.Generic.List NetworkConfiguration { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.json.cs new file mode 100644 index 00000000000..f4dc9ff412f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataBoxSecret.json.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The secrets related to a DataBox. + public partial class DataBoxSecret + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataBoxSecret(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_deviceSerialNumber = If( json?.PropertyT("deviceSerialNumber"), out var __jsonDeviceSerialNumber) ? (string)__jsonDeviceSerialNumber : (string)_deviceSerialNumber;} + {_devicePassword = If( json?.PropertyT("devicePassword"), out var __jsonDevicePassword) ? (string)__jsonDevicePassword : (string)_devicePassword;} + {_networkConfiguration = If( json?.PropertyT("networkConfigurations"), out var __jsonNetworkConfigurations) ? If( __jsonNetworkConfigurations as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApplianceNetworkConfiguration) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ApplianceNetworkConfiguration.FromJson(__u) )) ))() : null : _networkConfiguration;} + {_encodedValidationCertPubKey = If( json?.PropertyT("encodedValidationCertPubKey"), out var __jsonEncodedValidationCertPubKey) ? (string)__jsonEncodedValidationCertPubKey : (string)_encodedValidationCertPubKey;} + {_accountCredentialDetail = If( json?.PropertyT("accountCredentialDetails"), out var __jsonAccountCredentialDetails) ? If( __jsonAccountCredentialDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IAccountCredentialDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AccountCredentialDetails.FromJson(__p) )) ))() : null : _accountCredentialDetail;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecret. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecret. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecret FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataBoxSecret(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._deviceSerialNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._deviceSerialNumber.ToString()) : null, "deviceSerialNumber" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._devicePassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._devicePassword.ToString()) : null, "devicePassword" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._networkConfiguration) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._networkConfiguration ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("networkConfigurations",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._encodedValidationCertPubKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._encodedValidationCertPubKey.ToString()) : null, "encodedValidationCertPubKey" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._accountCredentialDetail) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __s in this._accountCredentialDetail ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("accountCredentialDetails",__r); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.PowerShell.cs new file mode 100644 index 00000000000..e1e2c75b27f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.PowerShell.cs @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Details of the data to be used for exporting data from azure. + [System.ComponentModel.TypeConverter(typeof(DataExportDetailsTypeConverter))] + public partial class DataExportDetails + { + + /// + /// 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 DataExportDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TransferConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration) content.GetValueForProperty("TransferConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfiguration, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("AccountDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AccountDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails) content.GetValueForProperty("AccountDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AccountDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("LogCollectionLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).LogCollectionLevel = (string) content.GetValueForProperty("LogCollectionLevel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).LogCollectionLevel, global::System.Convert.ToString); + } + if (content.Contains("TransferConfigurationTransferFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfigurationTransferFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails) content.GetValueForProperty("TransferConfigurationTransferFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfigurationTransferFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferConfigurationTransferAllDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfigurationTransferAllDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails) content.GetValueForProperty("TransferConfigurationTransferAllDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfigurationTransferAllDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferAllDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferConfigurationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfigurationType = (string) content.GetValueForProperty("TransferConfigurationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfigurationType, global::System.Convert.ToString); + } + if (content.Contains("TransferFilterDetailInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferFilterDetailInclude = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails) content.GetValueForProperty("TransferFilterDetailInclude",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferFilterDetailInclude, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferAllDetailInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferAllDetailInclude = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails) content.GetValueForProperty("TransferAllDetailInclude",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferAllDetailInclude, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferAllDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("AccountDetailDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AccountDetailDataAccountType = (string) content.GetValueForProperty("AccountDetailDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AccountDetailDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountDetailSharePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AccountDetailSharePassword = (System.Security.SecureString) content.GetValueForProperty("AccountDetailSharePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AccountDetailSharePassword, (object ss) => (System.Security.SecureString)ss); + } + if (content.Contains("IncludeBlobFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeBlobFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails) content.GetValueForProperty("IncludeBlobFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeBlobFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.BlobFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeAzureFileFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeAzureFileFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails) content.GetValueForProperty("IncludeAzureFileFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeAzureFileFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AzureFileFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferFilterDetailsIncludeDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferFilterDetailsIncludeDataAccountType = (string) content.GetValueForProperty("TransferFilterDetailsIncludeDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferFilterDetailsIncludeDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("IncludeFilterFileDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeFilterFileDetail = (System.Collections.Generic.List) content.GetValueForProperty("IncludeFilterFileDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeFilterFileDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.FilterFileDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("TransferAllDetailsIncludeDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferAllDetailsIncludeDataAccountType = (string) content.GetValueForProperty("TransferAllDetailsIncludeDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferAllDetailsIncludeDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("IncludeTransferAllBlob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeTransferAllBlob = (bool?) content.GetValueForProperty("IncludeTransferAllBlob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeTransferAllBlob, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IncludeTransferAllFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeTransferAllFile = (bool?) content.GetValueForProperty("IncludeTransferAllFile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeTransferAllFile, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("BlobFilterDetailBlobPrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).BlobFilterDetailBlobPrefixList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).BlobFilterDetailBlobPrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailBlobPathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).BlobFilterDetailBlobPathList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).BlobFilterDetailBlobPathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailContainerList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).BlobFilterDetailContainerList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailContainerList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).BlobFilterDetailContainerList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AzureFileFilterDetailFilePrefixList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AzureFileFilterDetailFilePrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AzureFileFilterDetailFilePathList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AzureFileFilterDetailFilePathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFileShareList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AzureFileFilterDetailFileShareList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFileShareList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AzureFileFilterDetailFileShareList, __y => TypeConverterExtensions.SelectToList(__y, 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 DataExportDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TransferConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration) content.GetValueForProperty("TransferConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfiguration, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("AccountDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AccountDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails) content.GetValueForProperty("AccountDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AccountDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("LogCollectionLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).LogCollectionLevel = (string) content.GetValueForProperty("LogCollectionLevel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).LogCollectionLevel, global::System.Convert.ToString); + } + if (content.Contains("TransferConfigurationTransferFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfigurationTransferFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails) content.GetValueForProperty("TransferConfigurationTransferFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfigurationTransferFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferConfigurationTransferAllDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfigurationTransferAllDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails) content.GetValueForProperty("TransferConfigurationTransferAllDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfigurationTransferAllDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferAllDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferConfigurationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfigurationType = (string) content.GetValueForProperty("TransferConfigurationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferConfigurationType, global::System.Convert.ToString); + } + if (content.Contains("TransferFilterDetailInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferFilterDetailInclude = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails) content.GetValueForProperty("TransferFilterDetailInclude",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferFilterDetailInclude, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferAllDetailInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferAllDetailInclude = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails) content.GetValueForProperty("TransferAllDetailInclude",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferAllDetailInclude, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferAllDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("AccountDetailDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AccountDetailDataAccountType = (string) content.GetValueForProperty("AccountDetailDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AccountDetailDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountDetailSharePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AccountDetailSharePassword = (System.Security.SecureString) content.GetValueForProperty("AccountDetailSharePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AccountDetailSharePassword, (object ss) => (System.Security.SecureString)ss); + } + if (content.Contains("IncludeBlobFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeBlobFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails) content.GetValueForProperty("IncludeBlobFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeBlobFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.BlobFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeAzureFileFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeAzureFileFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails) content.GetValueForProperty("IncludeAzureFileFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeAzureFileFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AzureFileFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferFilterDetailsIncludeDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferFilterDetailsIncludeDataAccountType = (string) content.GetValueForProperty("TransferFilterDetailsIncludeDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferFilterDetailsIncludeDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("IncludeFilterFileDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeFilterFileDetail = (System.Collections.Generic.List) content.GetValueForProperty("IncludeFilterFileDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeFilterFileDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.FilterFileDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("TransferAllDetailsIncludeDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferAllDetailsIncludeDataAccountType = (string) content.GetValueForProperty("TransferAllDetailsIncludeDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).TransferAllDetailsIncludeDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("IncludeTransferAllBlob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeTransferAllBlob = (bool?) content.GetValueForProperty("IncludeTransferAllBlob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeTransferAllBlob, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IncludeTransferAllFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeTransferAllFile = (bool?) content.GetValueForProperty("IncludeTransferAllFile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).IncludeTransferAllFile, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("BlobFilterDetailBlobPrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).BlobFilterDetailBlobPrefixList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).BlobFilterDetailBlobPrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailBlobPathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).BlobFilterDetailBlobPathList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).BlobFilterDetailBlobPathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailContainerList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).BlobFilterDetailContainerList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailContainerList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).BlobFilterDetailContainerList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AzureFileFilterDetailFilePrefixList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AzureFileFilterDetailFilePrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AzureFileFilterDetailFilePathList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AzureFileFilterDetailFilePathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFileShareList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AzureFileFilterDetailFileShareList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFileShareList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal)this).AzureFileFilterDetailFileShareList, __y => TypeConverterExtensions.SelectToList(__y, 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.DataBox.Models.IDataExportDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataExportDetails(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.DataBox.Models.IDataExportDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataExportDetails(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.DataBox.Models.IDataExportDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Details of the data to be used for exporting data from azure. + [System.ComponentModel.TypeConverter(typeof(DataExportDetailsTypeConverter))] + public partial interface IDataExportDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.TypeConverter.cs new file mode 100644 index 00000000000..6d410f641b0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataExportDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataExportDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataExportDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataExportDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.cs new file mode 100644 index 00000000000..a0d3005a9eb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.cs @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details of the data to be used for exporting data from azure. + public partial class DataExportDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails _accountDetail; + + /// Account details of the data to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails AccountDetail { get => (this._accountDetail = this._accountDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetails()); set => this._accountDetail = value; } + + /// Account Type of the data to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string AccountDetailDataAccountType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)AccountDetail).DataAccountType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)AccountDetail).DataAccountType = value ; } + + /// + /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If + /// this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements + /// : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one + /// number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, + /// numbers and these characters : @#\-$%^!+=;:_()]+ + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Security.SecureString AccountDetailSharePassword { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)AccountDetail).SharePassword; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)AccountDetail).SharePassword = value ?? null; } + + /// List of full path of the files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AzureFileFilterDetailFilePathList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).AzureFileFilterDetailFilePathList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).AzureFileFilterDetailFilePathList = value ?? null /* arrayOf */; } + + /// Prefix list of the Azure files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AzureFileFilterDetailFilePrefixList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).AzureFileFilterDetailFilePrefixList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).AzureFileFilterDetailFilePrefixList = value ?? null /* arrayOf */; } + + /// List of file shares to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AzureFileFilterDetailFileShareList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).AzureFileFilterDetailFileShareList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).AzureFileFilterDetailFileShareList = value ?? null /* arrayOf */; } + + /// List of full path of the blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List BlobFilterDetailBlobPathList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).BlobFilterDetailBlobPathList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).BlobFilterDetailBlobPathList = value ?? null /* arrayOf */; } + + /// Prefix list of the Azure blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List BlobFilterDetailBlobPrefixList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).BlobFilterDetailBlobPrefixList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).BlobFilterDetailBlobPrefixList = value ?? null /* arrayOf */; } + + /// List of blob containers to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List BlobFilterDetailContainerList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).BlobFilterDetailContainerList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).BlobFilterDetailContainerList = value ?? null /* arrayOf */; } + + /// Details of the filter files to be used for data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List IncludeFilterFileDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).IncludeFilterFileDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).IncludeFilterFileDetail = value ?? null /* arrayOf */; } + + /// To indicate if all Azure blobs have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? IncludeTransferAllBlob { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).IncludeTransferAllBlob; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).IncludeTransferAllBlob = value ?? default(bool); } + + /// To indicate if all Azure Files have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? IncludeTransferAllFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).IncludeTransferAllFile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).IncludeTransferAllFile = value ?? default(bool); } + + /// Backing field for property. + private string _logCollectionLevel; + + /// Level of the logs to be collected. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string LogCollectionLevel { get => this._logCollectionLevel; set => this._logCollectionLevel = value; } + + /// Internal Acessors for AccountDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal.AccountDetail { get => (this._accountDetail = this._accountDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetails()); set { {_accountDetail = value;} } } + + /// Internal Acessors for IncludeAzureFileFilterDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal.IncludeAzureFileFilterDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).IncludeAzureFileFilterDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).IncludeAzureFileFilterDetail = value ?? null /* model class */; } + + /// Internal Acessors for IncludeBlobFilterDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal.IncludeBlobFilterDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).IncludeBlobFilterDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).IncludeBlobFilterDetail = value ?? null /* model class */; } + + /// Internal Acessors for TransferAllDetailInclude + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal.TransferAllDetailInclude { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).TransferAllDetailInclude; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).TransferAllDetailInclude = value ?? null /* model class */; } + + /// Internal Acessors for TransferConfiguration + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal.TransferConfiguration { get => (this._transferConfiguration = this._transferConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfiguration()); set { {_transferConfiguration = value;} } } + + /// Internal Acessors for TransferConfigurationTransferAllDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal.TransferConfigurationTransferAllDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).TransferAllDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).TransferAllDetail = value ?? null /* model class */; } + + /// Internal Acessors for TransferConfigurationTransferFilterDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal.TransferConfigurationTransferFilterDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).TransferFilterDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).TransferFilterDetail = value ?? null /* model class */; } + + /// Internal Acessors for TransferFilterDetailInclude + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetailsInternal.TransferFilterDetailInclude { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).TransferFilterDetailInclude; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).TransferFilterDetailInclude = value ?? null /* model class */; } + + /// Type of the account of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransferAllDetailsIncludeDataAccountType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).TransferAllDetailsIncludeDataAccountType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).TransferAllDetailsIncludeDataAccountType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration _transferConfiguration; + + /// Configuration for the data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration TransferConfiguration { get => (this._transferConfiguration = this._transferConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfiguration()); set => this._transferConfiguration = value; } + + /// Type of the configuration for transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransferConfigurationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).Type = value ; } + + /// Type of the account of data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransferFilterDetailsIncludeDataAccountType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).TransferFilterDetailsIncludeDataAccountType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)TransferConfiguration).TransferFilterDetailsIncludeDataAccountType = value ?? null; } + + /// Creates an new instance. + public DataExportDetails() + { + + } + } + /// Details of the data to be used for exporting data from azure. + public partial interface IDataExportDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Account Type of the data to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Account Type of the data to be transferred.", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string AccountDetailDataAccountType { get; set; } + /// + /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If + /// this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements + /// : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one + /// number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, + /// numbers and these characters : @#\-$%^!+=;:_()]+ + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = false, + Create = true, + Update = false, + Description = @"Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+", + SerializedName = @"sharePassword", + PossibleTypes = new [] { typeof(System.Security.SecureString) })] + System.Security.SecureString AccountDetailSharePassword { get; set; } + /// List of full path of the files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of full path of the files to be transferred.", + SerializedName = @"filePathList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AzureFileFilterDetailFilePathList { get; set; } + /// Prefix list of the Azure files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Prefix list of the Azure files to be transferred.", + SerializedName = @"filePrefixList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AzureFileFilterDetailFilePrefixList { get; set; } + /// List of file shares to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of file shares to be transferred.", + SerializedName = @"fileShareList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AzureFileFilterDetailFileShareList { get; set; } + /// List of full path of the blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of full path of the blobs to be transferred.", + SerializedName = @"blobPathList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobFilterDetailBlobPathList { get; set; } + /// Prefix list of the Azure blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Prefix list of the Azure blobs to be transferred.", + SerializedName = @"blobPrefixList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobFilterDetailBlobPrefixList { get; set; } + /// List of blob containers to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of blob containers to be transferred.", + SerializedName = @"containerList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobFilterDetailContainerList { get; set; } + /// Details of the filter files to be used for data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details of the filter files to be used for data transfer.", + SerializedName = @"filterFileDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetails) })] + System.Collections.Generic.List IncludeFilterFileDetail { get; set; } + /// To indicate if all Azure blobs have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"To indicate if all Azure blobs have to be transferred", + SerializedName = @"transferAllBlobs", + PossibleTypes = new [] { typeof(bool) })] + bool? IncludeTransferAllBlob { get; set; } + /// To indicate if all Azure Files have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"To indicate if all Azure Files have to be transferred", + SerializedName = @"transferAllFiles", + PossibleTypes = new [] { typeof(bool) })] + bool? IncludeTransferAllFile { get; set; } + /// Level of the logs to be collected. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Level of the logs to be collected.", + SerializedName = @"logCollectionLevel", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Error", "Verbose")] + string LogCollectionLevel { get; set; } + /// Type of the account of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the account of data", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string TransferAllDetailsIncludeDataAccountType { get; set; } + /// Type of the configuration for transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the configuration for transfer.", + SerializedName = @"transferConfigurationType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("TransferAll", "TransferUsingFilter")] + string TransferConfigurationType { get; set; } + /// Type of the account of data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the account of data.", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string TransferFilterDetailsIncludeDataAccountType { get; set; } + + } + /// Details of the data to be used for exporting data from azure. + internal partial interface IDataExportDetailsInternal + + { + /// Account details of the data to be transferred + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails AccountDetail { get; set; } + /// Account Type of the data to be transferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string AccountDetailDataAccountType { get; set; } + /// + /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If + /// this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements + /// : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one + /// number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, + /// numbers and these characters : @#\-$%^!+=;:_()]+ + /// + System.Security.SecureString AccountDetailSharePassword { get; set; } + /// List of full path of the files to be transferred. + System.Collections.Generic.List AzureFileFilterDetailFilePathList { get; set; } + /// Prefix list of the Azure files to be transferred. + System.Collections.Generic.List AzureFileFilterDetailFilePrefixList { get; set; } + /// List of file shares to be transferred. + System.Collections.Generic.List AzureFileFilterDetailFileShareList { get; set; } + /// List of full path of the blobs to be transferred. + System.Collections.Generic.List BlobFilterDetailBlobPathList { get; set; } + /// Prefix list of the Azure blobs to be transferred. + System.Collections.Generic.List BlobFilterDetailBlobPrefixList { get; set; } + /// List of blob containers to be transferred. + System.Collections.Generic.List BlobFilterDetailContainerList { get; set; } + /// Filter details to transfer Azure files. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails IncludeAzureFileFilterDetail { get; set; } + /// Filter details to transfer blobs. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails IncludeBlobFilterDetail { get; set; } + /// Details of the filter files to be used for data transfer. + System.Collections.Generic.List IncludeFilterFileDetail { get; set; } + /// To indicate if all Azure blobs have to be transferred + bool? IncludeTransferAllBlob { get; set; } + /// To indicate if all Azure Files have to be transferred + bool? IncludeTransferAllFile { get; set; } + /// Level of the logs to be collected. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Error", "Verbose")] + string LogCollectionLevel { get; set; } + /// Details to transfer all data. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails TransferAllDetailInclude { get; set; } + /// Type of the account of data + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string TransferAllDetailsIncludeDataAccountType { get; set; } + /// Configuration for the data transfer. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration TransferConfiguration { get; set; } + /// + /// Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType + /// is given as TransferAll + /// + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails TransferConfigurationTransferAllDetail { get; set; } + /// + /// Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as + /// TransferUsingFilter. + /// + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails TransferConfigurationTransferFilterDetail { get; set; } + /// Type of the configuration for transfer. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("TransferAll", "TransferUsingFilter")] + string TransferConfigurationType { get; set; } + /// Details of the filtering the transfer of data. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails TransferFilterDetailInclude { get; set; } + /// Type of the account of data. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string TransferFilterDetailsIncludeDataAccountType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.json.cs new file mode 100644 index 00000000000..5e4c0f74928 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataExportDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details of the data to be used for exporting data from azure. + public partial class DataExportDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataExportDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_transferConfiguration = If( json?.PropertyT("transferConfiguration"), out var __jsonTransferConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfiguration.FromJson(__jsonTransferConfiguration) : _transferConfiguration;} + {_accountDetail = If( json?.PropertyT("accountDetails"), out var __jsonAccountDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetails.FromJson(__jsonAccountDetails) : _accountDetail;} + {_logCollectionLevel = If( json?.PropertyT("logCollectionLevel"), out var __jsonLogCollectionLevel) ? (string)__jsonLogCollectionLevel : (string)_logCollectionLevel;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataExportDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._transferConfiguration ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._transferConfiguration.ToJson(null,serializationMode) : null, "transferConfiguration" ,container.Add ); + AddIf( null != this._accountDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._accountDetail.ToJson(null,serializationMode) : null, "accountDetails" ,container.Add ); + AddIf( null != (((object)this._logCollectionLevel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._logCollectionLevel.ToString()) : null, "logCollectionLevel" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.PowerShell.cs new file mode 100644 index 00000000000..588f0ce1f6b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Details of the data to be used for importing data to azure. + [System.ComponentModel.TypeConverter(typeof(DataImportDetailsTypeConverter))] + public partial class DataImportDetails + { + + /// + /// 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 DataImportDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AccountDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).AccountDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails) content.GetValueForProperty("AccountDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).AccountDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("LogCollectionLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).LogCollectionLevel = (string) content.GetValueForProperty("LogCollectionLevel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).LogCollectionLevel, global::System.Convert.ToString); + } + if (content.Contains("AccountDetailDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).AccountDetailDataAccountType = (string) content.GetValueForProperty("AccountDetailDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).AccountDetailDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountDetailSharePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).AccountDetailSharePassword = (System.Security.SecureString) content.GetValueForProperty("AccountDetailSharePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).AccountDetailSharePassword, (object ss) => (System.Security.SecureString)ss); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DataImportDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AccountDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).AccountDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails) content.GetValueForProperty("AccountDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).AccountDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("LogCollectionLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).LogCollectionLevel = (string) content.GetValueForProperty("LogCollectionLevel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).LogCollectionLevel, global::System.Convert.ToString); + } + if (content.Contains("AccountDetailDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).AccountDetailDataAccountType = (string) content.GetValueForProperty("AccountDetailDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).AccountDetailDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountDetailSharePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).AccountDetailSharePassword = (System.Security.SecureString) content.GetValueForProperty("AccountDetailSharePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal)this).AccountDetailSharePassword, (object ss) => (System.Security.SecureString)ss); + } + 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.DataBox.Models.IDataImportDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataImportDetails(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.DataBox.Models.IDataImportDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataImportDetails(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.DataBox.Models.IDataImportDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Details of the data to be used for importing data to azure. + [System.ComponentModel.TypeConverter(typeof(DataImportDetailsTypeConverter))] + public partial interface IDataImportDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.TypeConverter.cs new file mode 100644 index 00000000000..d1bf36966c1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataImportDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataImportDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataImportDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataImportDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.cs new file mode 100644 index 00000000000..53c0d077593 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details of the data to be used for importing data to azure. + public partial class DataImportDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails _accountDetail; + + /// Account details of the data to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails AccountDetail { get => (this._accountDetail = this._accountDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetails()); set => this._accountDetail = value; } + + /// Account Type of the data to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string AccountDetailDataAccountType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)AccountDetail).DataAccountType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)AccountDetail).DataAccountType = value ; } + + /// + /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If + /// this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements + /// : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one + /// number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, + /// numbers and these characters : @#\-$%^!+=;:_()]+ + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Security.SecureString AccountDetailSharePassword { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)AccountDetail).SharePassword; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)AccountDetail).SharePassword = value ?? null; } + + /// Backing field for property. + private string _logCollectionLevel; + + /// Level of the logs to be collected. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string LogCollectionLevel { get => this._logCollectionLevel; set => this._logCollectionLevel = value; } + + /// Internal Acessors for AccountDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetailsInternal.AccountDetail { get => (this._accountDetail = this._accountDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetails()); set { {_accountDetail = value;} } } + + /// Creates an new instance. + public DataImportDetails() + { + + } + } + /// Details of the data to be used for importing data to azure. + public partial interface IDataImportDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Account Type of the data to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Account Type of the data to be transferred.", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string AccountDetailDataAccountType { get; set; } + /// + /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If + /// this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements + /// : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one + /// number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, + /// numbers and these characters : @#\-$%^!+=;:_()]+ + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = false, + Create = true, + Update = false, + Description = @"Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+", + SerializedName = @"sharePassword", + PossibleTypes = new [] { typeof(System.Security.SecureString) })] + System.Security.SecureString AccountDetailSharePassword { get; set; } + /// Level of the logs to be collected. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Level of the logs to be collected.", + SerializedName = @"logCollectionLevel", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Error", "Verbose")] + string LogCollectionLevel { get; set; } + + } + /// Details of the data to be used for importing data to azure. + internal partial interface IDataImportDetailsInternal + + { + /// Account details of the data to be transferred + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails AccountDetail { get; set; } + /// Account Type of the data to be transferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string AccountDetailDataAccountType { get; set; } + /// + /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If + /// this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements + /// : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one + /// number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, + /// numbers and these characters : @#\-$%^!+=;:_()]+ + /// + System.Security.SecureString AccountDetailSharePassword { get; set; } + /// Level of the logs to be collected. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Error", "Verbose")] + string LogCollectionLevel { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.json.cs new file mode 100644 index 00000000000..dcca5fb41f7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataImportDetails.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details of the data to be used for importing data to azure. + public partial class DataImportDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataImportDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_accountDetail = If( json?.PropertyT("accountDetails"), out var __jsonAccountDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetails.FromJson(__jsonAccountDetails) : _accountDetail;} + {_logCollectionLevel = If( json?.PropertyT("logCollectionLevel"), out var __jsonLogCollectionLevel) ? (string)__jsonLogCollectionLevel : (string)_logCollectionLevel;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataImportDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._accountDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._accountDetail.ToJson(null,serializationMode) : null, "accountDetails" ,container.Add ); + AddIf( null != (((object)this._logCollectionLevel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._logCollectionLevel.ToString()) : null, "logCollectionLevel" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.PowerShell.cs new file mode 100644 index 00000000000..9da455c1ea8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Map of data location to service location + [System.ComponentModel.TypeConverter(typeof(DataLocationToServiceLocationMapTypeConverter))] + public partial class DataLocationToServiceLocationMap + { + + /// + /// 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 DataLocationToServiceLocationMap(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMapInternal)this).DataLocation = (string) content.GetValueForProperty("DataLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMapInternal)this).DataLocation, global::System.Convert.ToString); + } + if (content.Contains("ServiceLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMapInternal)this).ServiceLocation = (string) content.GetValueForProperty("ServiceLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMapInternal)this).ServiceLocation, 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 DataLocationToServiceLocationMap(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMapInternal)this).DataLocation = (string) content.GetValueForProperty("DataLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMapInternal)this).DataLocation, global::System.Convert.ToString); + } + if (content.Contains("ServiceLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMapInternal)this).ServiceLocation = (string) content.GetValueForProperty("ServiceLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMapInternal)this).ServiceLocation, 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.DataBox.Models.IDataLocationToServiceLocationMap DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataLocationToServiceLocationMap(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.DataBox.Models.IDataLocationToServiceLocationMap DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataLocationToServiceLocationMap(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.DataBox.Models.IDataLocationToServiceLocationMap FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Map of data location to service location + [System.ComponentModel.TypeConverter(typeof(DataLocationToServiceLocationMapTypeConverter))] + public partial interface IDataLocationToServiceLocationMap + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.TypeConverter.cs new file mode 100644 index 00000000000..ddf56073e8c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataLocationToServiceLocationMapTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMap ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMap).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataLocationToServiceLocationMap.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataLocationToServiceLocationMap.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataLocationToServiceLocationMap.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.cs new file mode 100644 index 00000000000..ca2c36b66a5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Map of data location to service location + public partial class DataLocationToServiceLocationMap : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMap, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMapInternal + { + + /// Backing field for property. + private string _dataLocation; + + /// Location of the data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DataLocation { get => this._dataLocation; } + + /// Internal Acessors for DataLocation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMapInternal.DataLocation { get => this._dataLocation; set { {_dataLocation = value;} } } + + /// Internal Acessors for ServiceLocation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMapInternal.ServiceLocation { get => this._serviceLocation; set { {_serviceLocation = value;} } } + + /// Backing field for property. + private string _serviceLocation; + + /// Location of the service. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ServiceLocation { get => this._serviceLocation; } + + /// Creates an new instance. + public DataLocationToServiceLocationMap() + { + + } + } + /// Map of data location to service location + public partial interface IDataLocationToServiceLocationMap : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Location of the data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Location of the data.", + SerializedName = @"dataLocation", + PossibleTypes = new [] { typeof(string) })] + string DataLocation { get; } + /// Location of the service. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Location of the service.", + SerializedName = @"serviceLocation", + PossibleTypes = new [] { typeof(string) })] + string ServiceLocation { get; } + + } + /// Map of data location to service location + internal partial interface IDataLocationToServiceLocationMapInternal + + { + /// Location of the data. + string DataLocation { get; set; } + /// Location of the service. + string ServiceLocation { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.json.cs new file mode 100644 index 00000000000..8481af53047 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataLocationToServiceLocationMap.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Map of data location to service location + public partial class DataLocationToServiceLocationMap + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataLocationToServiceLocationMap(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_dataLocation = If( json?.PropertyT("dataLocation"), out var __jsonDataLocation) ? (string)__jsonDataLocation : (string)_dataLocation;} + {_serviceLocation = If( json?.PropertyT("serviceLocation"), out var __jsonServiceLocation) ? (string)__jsonServiceLocation : (string)_serviceLocation;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMap. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMap. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMap FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataLocationToServiceLocationMap(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._dataLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._dataLocation.ToString()) : null, "dataLocation" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._serviceLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._serviceLocation.ToString()) : null, "serviceLocation" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.PowerShell.cs new file mode 100644 index 00000000000..8d0cafcd0bd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.PowerShell.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request to validate export and import data details. + [System.ComponentModel.TypeConverter(typeof(DataTransferDetailsValidationRequestTypeConverter))] + public partial class DataTransferDetailsValidationRequest + { + + /// + /// 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 DataTransferDetailsValidationRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataExportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).DataExportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataExportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).DataExportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DataImportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).DataImportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataImportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).DataImportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DeviceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).DeviceType = (string) content.GetValueForProperty("DeviceType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).DeviceType, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).Model, global::System.Convert.ToString); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, 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 DataTransferDetailsValidationRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataExportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).DataExportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataExportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).DataExportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DataImportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).DataImportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataImportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).DataImportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DeviceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).DeviceType = (string) content.GetValueForProperty("DeviceType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).DeviceType, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal)this).Model, global::System.Convert.ToString); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, 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.DataBox.Models.IDataTransferDetailsValidationRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataTransferDetailsValidationRequest(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.DataBox.Models.IDataTransferDetailsValidationRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataTransferDetailsValidationRequest(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.DataBox.Models.IDataTransferDetailsValidationRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Request to validate export and import data details. + [System.ComponentModel.TypeConverter(typeof(DataTransferDetailsValidationRequestTypeConverter))] + public partial interface IDataTransferDetailsValidationRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.TypeConverter.cs new file mode 100644 index 00000000000..6c8b70accb7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataTransferDetailsValidationRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataTransferDetailsValidationRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataTransferDetailsValidationRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataTransferDetailsValidationRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.cs new file mode 100644 index 00000000000..86cbcf4bb7b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request to validate export and import data details. + public partial class DataTransferDetailsValidationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequestInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest __validationInputRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest(); + + /// Backing field for property. + private System.Collections.Generic.List _dataExportDetail; + + /// List of DataTransfer details to be used to export data from azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List DataExportDetail { get => this._dataExportDetail; set => this._dataExportDetail = value; } + + /// Backing field for property. + private System.Collections.Generic.List _dataImportDetail; + + /// List of DataTransfer details to be used to import data to azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List DataImportDetail { get => this._dataImportDetail; set => this._dataImportDetail = value; } + + /// Backing field for property. + private string _deviceType; + + /// Device type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DeviceType { get => this._deviceType; set => this._deviceType = value; } + + /// Backing field for property. + private string _model; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Model { get => this._model; set => this._model = value; } + + /// Backing field for property. + private string _transferType; + + /// Type of the transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string TransferType { get => this._transferType; set => this._transferType = value; } + + /// Identifies the type of validation request. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationType { get => "ValidateDataTransferDetails"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)__validationInputRequest).ValidationType = "ValidateDataTransferDetails"; } + + /// Creates an new instance. + public DataTransferDetailsValidationRequest() + { + this.__validationInputRequest.ValidationType = "ValidateDataTransferDetails"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationInputRequest), __validationInputRequest); + await eventListener.AssertObjectIsValid(nameof(__validationInputRequest), __validationInputRequest); + } + } + /// Request to validate export and import data details. + public partial interface IDataTransferDetailsValidationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest + { + /// List of DataTransfer details to be used to export data from azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of DataTransfer details to be used to export data from azure.", + SerializedName = @"dataExportDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetails) })] + System.Collections.Generic.List DataExportDetail { get; set; } + /// List of DataTransfer details to be used to import data to azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of DataTransfer details to be used to import data to azure.", + SerializedName = @"dataImportDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetails) })] + System.Collections.Generic.List DataImportDetail { get; set; } + /// Device type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Device type.", + SerializedName = @"deviceType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DeviceType { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Type of the transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the transfer.", + SerializedName = @"transferType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; set; } + + } + /// Request to validate export and import data details. + internal partial interface IDataTransferDetailsValidationRequestInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal + { + /// List of DataTransfer details to be used to export data from azure. + System.Collections.Generic.List DataExportDetail { get; set; } + /// List of DataTransfer details to be used to import data to azure. + System.Collections.Generic.List DataImportDetail { get; set; } + /// Device type. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DeviceType { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Type of the transfer. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.json.cs new file mode 100644 index 00000000000..cddb4b60a22 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationRequest.json.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request to validate export and import data details. + public partial class DataTransferDetailsValidationRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataTransferDetailsValidationRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationInputRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest(json); + {_dataExportDetail = If( json?.PropertyT("dataExportDetails"), out var __jsonDataExportDetails) ? If( __jsonDataExportDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDataExportDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetails.FromJson(__u) )) ))() : null : _dataExportDetail;} + {_dataImportDetail = If( json?.PropertyT("dataImportDetails"), out var __jsonDataImportDetails) ? If( __jsonDataImportDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDataImportDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetails.FromJson(__p) )) ))() : null : _dataImportDetail;} + {_deviceType = If( json?.PropertyT("deviceType"), out var __jsonDeviceType) ? (string)__jsonDeviceType : (string)_deviceType;} + {_transferType = If( json?.PropertyT("transferType"), out var __jsonTransferType) ? (string)__jsonTransferType : (string)_transferType;} + {_model = If( json?.PropertyT("model"), out var __jsonModel) ? (string)__jsonModel : (string)_model;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataTransferDetailsValidationRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationInputRequest?.ToJson(container, serializationMode); + if (null != this._dataExportDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._dataExportDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("dataExportDetails",__w); + } + if (null != this._dataImportDetail) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __s in this._dataImportDetail ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("dataImportDetails",__r); + } + AddIf( null != (((object)this._deviceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._deviceType.ToString()) : null, "deviceType" ,container.Add ); + AddIf( null != (((object)this._transferType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._transferType.ToString()) : null, "transferType" ,container.Add ); + AddIf( null != (((object)this._model)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._model.ToString()) : null, "model" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.PowerShell.cs new file mode 100644 index 00000000000..fa5c366a5a8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.PowerShell.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Properties of data transfer details validation response. + [System.ComponentModel.TypeConverter(typeof(DataTransferDetailsValidationResponsePropertiesTypeConverter))] + public partial class DataTransferDetailsValidationResponseProperties + { + + /// + /// 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 DataTransferDetailsValidationResponseProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationResponsePropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationResponsePropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, 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 DataTransferDetailsValidationResponseProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationResponsePropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationResponsePropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, 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.DataBox.Models.IDataTransferDetailsValidationResponseProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataTransferDetailsValidationResponseProperties(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.DataBox.Models.IDataTransferDetailsValidationResponseProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataTransferDetailsValidationResponseProperties(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.DataBox.Models.IDataTransferDetailsValidationResponseProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 data transfer details validation response. + [System.ComponentModel.TypeConverter(typeof(DataTransferDetailsValidationResponsePropertiesTypeConverter))] + public partial interface IDataTransferDetailsValidationResponseProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.TypeConverter.cs new file mode 100644 index 00000000000..54b355d82b7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataTransferDetailsValidationResponsePropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationResponseProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationResponseProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataTransferDetailsValidationResponseProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataTransferDetailsValidationResponseProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataTransferDetailsValidationResponseProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.cs new file mode 100644 index 00000000000..e3ebb5e6e06 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of data transfer details validation response. + public partial class DataTransferDetailsValidationResponseProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationResponseProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationResponsePropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse __validationInputResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse(); + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail; } + + /// Error code and message of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error = value ?? null /* model class */; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message; } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationResponsePropertiesInternal.Status { get => this._status; set { {_status = value;} } } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error = value ?? null /* model class */; } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target = value ?? null; } + + /// Backing field for property. + private string _status; + + /// Data transfer details validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Status { get => this._status; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target; } + + /// Identifies the type of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationType { get => "ValidateDataTransferDetails"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).ValidationType = "ValidateDataTransferDetails"; } + + /// + /// Creates an new instance. + /// + public DataTransferDetailsValidationResponseProperties() + { + this.__validationInputResponse.ValidationType = "ValidateDataTransferDetails"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationInputResponse), __validationInputResponse); + await eventListener.AssertObjectIsValid(nameof(__validationInputResponse), __validationInputResponse); + } + } + /// Properties of data transfer details validation response. + public partial interface IDataTransferDetailsValidationResponseProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse + { + /// Data transfer details validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Data transfer details validation status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Skipped")] + string Status { get; } + + } + /// Properties of data transfer details validation response. + internal partial interface IDataTransferDetailsValidationResponsePropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal + { + /// Data transfer details validation status. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Skipped")] + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.json.cs new file mode 100644 index 00000000000..128d0dcdd69 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataTransferDetailsValidationResponseProperties.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of data transfer details validation response. + public partial class DataTransferDetailsValidationResponseProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataTransferDetailsValidationResponseProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationInputResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse(json); + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationResponseProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationResponseProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationResponseProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataTransferDetailsValidationResponseProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationInputResponse?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.PowerShell.cs new file mode 100644 index 00000000000..e4c058dd177 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.PowerShell.cs @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The secrets related to a databox job. + [System.ComponentModel.TypeConverter(typeof(DataboxJobSecretsTypeConverter))] + public partial class DataboxJobSecrets + { + + /// + /// 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 DataboxJobSecrets(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PodSecret")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataboxJobSecretsInternal)this).PodSecret = (System.Collections.Generic.List) content.GetValueForProperty("PodSecret",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataboxJobSecretsInternal)this).PodSecret, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxSecretTypeConverter.ConvertFrom)); + } + if (content.Contains("DcAccessSecurityCodeReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode) content.GetValueForProperty("DcAccessSecurityCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCodeTypeConverter.ConvertFrom); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type, 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 DataboxJobSecrets(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PodSecret")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataboxJobSecretsInternal)this).PodSecret = (System.Collections.Generic.List) content.GetValueForProperty("PodSecret",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataboxJobSecretsInternal)this).PodSecret, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxSecretTypeConverter.ConvertFrom)); + } + if (content.Contains("DcAccessSecurityCodeReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode) content.GetValueForProperty("DcAccessSecurityCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCodeTypeConverter.ConvertFrom); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type, 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.DataBox.Models.IDataboxJobSecrets DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataboxJobSecrets(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.DataBox.Models.IDataboxJobSecrets DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataboxJobSecrets(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.DataBox.Models.IDataboxJobSecrets FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 secrets related to a databox job. + [System.ComponentModel.TypeConverter(typeof(DataboxJobSecretsTypeConverter))] + public partial interface IDataboxJobSecrets + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.TypeConverter.cs new file mode 100644 index 00000000000..f124470c805 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataboxJobSecretsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataboxJobSecrets ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataboxJobSecrets).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataboxJobSecrets.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataboxJobSecrets.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataboxJobSecrets.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.cs new file mode 100644 index 00000000000..d9d1ea34140 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The secrets related to a databox job. + public partial class DataboxJobSecrets : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataboxJobSecrets, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataboxJobSecretsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets __jobSecrets = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecrets(); + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).AdditionalInfo; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Code; } + + /// Dc Access Security Code for Customer Managed Shipping + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode DcAccessSecurityCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode = value ?? null /* model class */; } + + /// Forward Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DcAccessSecurityCodeForwardDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeForwardDcAccessCode; } + + /// Reverse Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DcAccessSecurityCodeReverseDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeReverseDcAccessCode; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Detail; } + + /// Error while fetching the secrets. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error = value ?? null /* model class */; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Code = value ?? null; } + + /// Internal Acessors for DcAccessSecurityCode + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCode = value ?? null /* model class */; } + + /// Internal Acessors for DcAccessSecurityCodeForwardDcAccessCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCodeForwardDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeForwardDcAccessCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeForwardDcAccessCode = value ?? null; } + + /// Internal Acessors for DcAccessSecurityCodeReverseDcAccessCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCodeReverseDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeReverseDcAccessCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).DcAccessSecurityCodeReverseDcAccessCode = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Error = value ?? null /* model class */; } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Target = value ?? null; } + + /// Backing field for property. + private System.Collections.Generic.List _podSecret; + + /// Contains the list of secret objects for a job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List PodSecret { get => this._podSecret; set => this._podSecret = value; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Target; } + + /// Used to indicate what type of job secrets object. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => "DataBox"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)__jobSecrets).Type = "DataBox"; } + + /// Creates an new instance. + public DataboxJobSecrets() + { + this.__jobSecrets.Type = "DataBox"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobSecrets), __jobSecrets); + await eventListener.AssertObjectIsValid(nameof(__jobSecrets), __jobSecrets); + } + } + /// The secrets related to a databox job. + public partial interface IDataboxJobSecrets : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets + { + /// Contains the list of secret objects for a job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Contains the list of secret objects for a job.", + SerializedName = @"podSecrets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxSecret) })] + System.Collections.Generic.List PodSecret { get; set; } + + } + /// The secrets related to a databox job. + internal partial interface IDataboxJobSecretsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal + { + /// Contains the list of secret objects for a job. + System.Collections.Generic.List PodSecret { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.json.cs new file mode 100644 index 00000000000..6da02bd2927 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DataboxJobSecrets.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The secrets related to a databox job. + public partial class DataboxJobSecrets + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DataboxJobSecrets(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobSecrets = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecrets(json); + {_podSecret = If( json?.PropertyT("podSecrets"), out var __jsonPodSecrets) ? If( __jsonPodSecrets as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDataBoxSecret) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataBoxSecret.FromJson(__u) )) ))() : null : _podSecret;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataboxJobSecrets. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataboxJobSecrets. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataboxJobSecrets FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DataboxJobSecrets(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobSecrets?.ToJson(container, serializationMode); + if (null != this._podSecret) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._podSecret ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("podSecrets",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.PowerShell.cs new file mode 100644 index 00000000000..280ce1c92b7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Datacenter instruction for given storage location. + [System.ComponentModel.TypeConverter(typeof(DatacenterAddressInstructionResponseTypeConverter))] + public partial class DatacenterAddressInstructionResponse + { + + /// + /// 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 DatacenterAddressInstructionResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CommunicationInstruction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressInstructionResponseInternal)this).CommunicationInstruction = (string) content.GetValueForProperty("CommunicationInstruction",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressInstructionResponseInternal)this).CommunicationInstruction, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("SupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).SupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("SupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).SupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DataCenterAzureLocation = (string) content.GetValueForProperty("DataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DataCenterAzureLocation, 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 DatacenterAddressInstructionResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CommunicationInstruction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressInstructionResponseInternal)this).CommunicationInstruction = (string) content.GetValueForProperty("CommunicationInstruction",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressInstructionResponseInternal)this).CommunicationInstruction, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("SupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).SupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("SupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).SupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DataCenterAzureLocation = (string) content.GetValueForProperty("DataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DataCenterAzureLocation, 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.DataBox.Models.IDatacenterAddressInstructionResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DatacenterAddressInstructionResponse(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.DataBox.Models.IDatacenterAddressInstructionResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DatacenterAddressInstructionResponse(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.DataBox.Models.IDatacenterAddressInstructionResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Datacenter instruction for given storage location. + [System.ComponentModel.TypeConverter(typeof(DatacenterAddressInstructionResponseTypeConverter))] + public partial interface IDatacenterAddressInstructionResponse + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.TypeConverter.cs new file mode 100644 index 00000000000..ebe8e8f44f1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DatacenterAddressInstructionResponseTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressInstructionResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressInstructionResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DatacenterAddressInstructionResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DatacenterAddressInstructionResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DatacenterAddressInstructionResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.cs new file mode 100644 index 00000000000..33e2d5c5319 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Datacenter instruction for given storage location. + public partial class DatacenterAddressInstructionResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressInstructionResponse, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressInstructionResponseInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse __datacenterAddressResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponse(); + + /// Backing field for property. + private string _communicationInstruction; + + /// Data center communication instruction + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CommunicationInstruction { get => this._communicationInstruction; } + + /// Azure Location where the Data Center serves primarily. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).DataCenterAzureLocation; } + + /// Data center address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DatacenterAddressType { get => "DatacenterAddressInstruction"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).DatacenterAddressType = "DatacenterAddressInstruction"; } + + /// Internal Acessors for CommunicationInstruction + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressInstructionResponseInternal.CommunicationInstruction { get => this._communicationInstruction; set { {_communicationInstruction = value;} } } + + /// Internal Acessors for DataCenterAzureLocation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal.DataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).DataCenterAzureLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).DataCenterAzureLocation = value ?? null; } + + /// Internal Acessors for SupportedCarriersForReturnShipment + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal.SupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).SupportedCarriersForReturnShipment; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).SupportedCarriersForReturnShipment = value ?? null /* arrayOf */; } + + /// List of supported carriers for return shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List SupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).SupportedCarriersForReturnShipment; } + + /// Creates an new instance. + public DatacenterAddressInstructionResponse() + { + this.__datacenterAddressResponse.DatacenterAddressType = "DatacenterAddressInstruction"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__datacenterAddressResponse), __datacenterAddressResponse); + await eventListener.AssertObjectIsValid(nameof(__datacenterAddressResponse), __datacenterAddressResponse); + } + } + /// Datacenter instruction for given storage location. + public partial interface IDatacenterAddressInstructionResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse + { + /// Data center communication instruction + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Data center communication instruction", + SerializedName = @"communicationInstruction", + PossibleTypes = new [] { typeof(string) })] + string CommunicationInstruction { get; } + + } + /// Datacenter instruction for given storage location. + internal partial interface IDatacenterAddressInstructionResponseInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal + { + /// Data center communication instruction + string CommunicationInstruction { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.json.cs new file mode 100644 index 00000000000..708db9ee070 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressInstructionResponse.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Datacenter instruction for given storage location. + public partial class DatacenterAddressInstructionResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DatacenterAddressInstructionResponse(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __datacenterAddressResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponse(json); + {_communicationInstruction = If( json?.PropertyT("communicationInstruction"), out var __jsonCommunicationInstruction) ? (string)__jsonCommunicationInstruction : (string)_communicationInstruction;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressInstructionResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressInstructionResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressInstructionResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DatacenterAddressInstructionResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __datacenterAddressResponse?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._communicationInstruction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._communicationInstruction.ToString()) : null, "communicationInstruction" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.PowerShell.cs new file mode 100644 index 00000000000..42c35d9baac --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.PowerShell.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Datacenter address for given storage location. + [System.ComponentModel.TypeConverter(typeof(DatacenterAddressLocationResponseTypeConverter))] + public partial class DatacenterAddressLocationResponse + { + + /// + /// 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 DatacenterAddressLocationResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContactPersonName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).ContactPersonName = (string) content.GetValueForProperty("ContactPersonName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).ContactPersonName, global::System.Convert.ToString); + } + if (content.Contains("Company")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Company = (string) content.GetValueForProperty("Company",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Company, global::System.Convert.ToString); + } + if (content.Contains("Street1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Street1 = (string) content.GetValueForProperty("Street1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Street1, global::System.Convert.ToString); + } + if (content.Contains("Street2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Street2 = (string) content.GetValueForProperty("Street2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Street2, global::System.Convert.ToString); + } + if (content.Contains("Street3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Street3 = (string) content.GetValueForProperty("Street3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Street3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("Zip")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Zip = (string) content.GetValueForProperty("Zip",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Zip, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Phone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Phone, global::System.Convert.ToString); + } + if (content.Contains("PhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).PhoneExtension = (string) content.GetValueForProperty("PhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).PhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("AddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).AddressType = (string) content.GetValueForProperty("AddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).AddressType, global::System.Convert.ToString); + } + if (content.Contains("AdditionalShippingInformation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).AdditionalShippingInformation = (string) content.GetValueForProperty("AdditionalShippingInformation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).AdditionalShippingInformation, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("SupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).SupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("SupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).SupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DataCenterAzureLocation = (string) content.GetValueForProperty("DataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DataCenterAzureLocation, 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 DatacenterAddressLocationResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContactPersonName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).ContactPersonName = (string) content.GetValueForProperty("ContactPersonName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).ContactPersonName, global::System.Convert.ToString); + } + if (content.Contains("Company")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Company = (string) content.GetValueForProperty("Company",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Company, global::System.Convert.ToString); + } + if (content.Contains("Street1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Street1 = (string) content.GetValueForProperty("Street1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Street1, global::System.Convert.ToString); + } + if (content.Contains("Street2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Street2 = (string) content.GetValueForProperty("Street2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Street2, global::System.Convert.ToString); + } + if (content.Contains("Street3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Street3 = (string) content.GetValueForProperty("Street3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Street3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("Zip")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Zip = (string) content.GetValueForProperty("Zip",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Zip, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Phone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).Phone, global::System.Convert.ToString); + } + if (content.Contains("PhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).PhoneExtension = (string) content.GetValueForProperty("PhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).PhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("AddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).AddressType = (string) content.GetValueForProperty("AddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).AddressType, global::System.Convert.ToString); + } + if (content.Contains("AdditionalShippingInformation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).AdditionalShippingInformation = (string) content.GetValueForProperty("AdditionalShippingInformation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal)this).AdditionalShippingInformation, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("SupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).SupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("SupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).SupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DataCenterAzureLocation = (string) content.GetValueForProperty("DataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DataCenterAzureLocation, 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.DataBox.Models.IDatacenterAddressLocationResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DatacenterAddressLocationResponse(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.DataBox.Models.IDatacenterAddressLocationResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DatacenterAddressLocationResponse(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.DataBox.Models.IDatacenterAddressLocationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Datacenter address for given storage location. + [System.ComponentModel.TypeConverter(typeof(DatacenterAddressLocationResponseTypeConverter))] + public partial interface IDatacenterAddressLocationResponse + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.TypeConverter.cs new file mode 100644 index 00000000000..0d7cf1f3d9a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DatacenterAddressLocationResponseTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DatacenterAddressLocationResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DatacenterAddressLocationResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DatacenterAddressLocationResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.cs new file mode 100644 index 00000000000..10090a61ee5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.cs @@ -0,0 +1,369 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Datacenter address for given storage location. + public partial class DatacenterAddressLocationResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponse, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse __datacenterAddressResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponse(); + + /// Backing field for property. + private string _additionalShippingInformation; + + /// Special instruction for shipping + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string AdditionalShippingInformation { get => this._additionalShippingInformation; } + + /// Backing field for property. + private string _addressType; + + /// Address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string AddressType { get => this._addressType; } + + /// Backing field for property. + private string _city; + + /// City name + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string City { get => this._city; } + + /// Backing field for property. + private string _company; + + /// Company name + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Company { get => this._company; } + + /// Backing field for property. + private string _contactPersonName; + + /// Contact person name + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ContactPersonName { get => this._contactPersonName; } + + /// Backing field for property. + private string _country; + + /// name of the country + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Country { get => this._country; } + + /// Azure Location where the Data Center serves primarily. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).DataCenterAzureLocation; } + + /// Data center address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DatacenterAddressType { get => "DatacenterAddressLocation"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).DatacenterAddressType = "DatacenterAddressLocation"; } + + /// Internal Acessors for AdditionalShippingInformation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.AdditionalShippingInformation { get => this._additionalShippingInformation; set { {_additionalShippingInformation = value;} } } + + /// Internal Acessors for AddressType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.AddressType { get => this._addressType; set { {_addressType = value;} } } + + /// Internal Acessors for City + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.City { get => this._city; set { {_city = value;} } } + + /// Internal Acessors for Company + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.Company { get => this._company; set { {_company = value;} } } + + /// Internal Acessors for ContactPersonName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.ContactPersonName { get => this._contactPersonName; set { {_contactPersonName = value;} } } + + /// Internal Acessors for Country + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.Country { get => this._country; set { {_country = value;} } } + + /// Internal Acessors for Phone + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.Phone { get => this._phone; set { {_phone = value;} } } + + /// Internal Acessors for PhoneExtension + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.PhoneExtension { get => this._phoneExtension; set { {_phoneExtension = value;} } } + + /// Internal Acessors for State + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.State { get => this._state; set { {_state = value;} } } + + /// Internal Acessors for Street1 + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.Street1 { get => this._street1; set { {_street1 = value;} } } + + /// Internal Acessors for Street2 + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.Street2 { get => this._street2; set { {_street2 = value;} } } + + /// Internal Acessors for Street3 + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.Street3 { get => this._street3; set { {_street3 = value;} } } + + /// Internal Acessors for Zip + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponseInternal.Zip { get => this._zip; set { {_zip = value;} } } + + /// Internal Acessors for DataCenterAzureLocation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal.DataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).DataCenterAzureLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).DataCenterAzureLocation = value ?? null; } + + /// Internal Acessors for SupportedCarriersForReturnShipment + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal.SupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).SupportedCarriersForReturnShipment; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).SupportedCarriersForReturnShipment = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string _phone; + + /// Phone number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Phone { get => this._phone; } + + /// Backing field for property. + private string _phoneExtension; + + /// Phone extension + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string PhoneExtension { get => this._phoneExtension; } + + /// Backing field for property. + private string _state; + + /// name of the state + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string State { get => this._state; } + + /// Backing field for property. + private string _street1; + + /// Street address line 1 + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Street1 { get => this._street1; } + + /// Backing field for property. + private string _street2; + + /// Street address line 2 + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Street2 { get => this._street2; } + + /// Backing field for property. + private string _street3; + + /// Street address line 3 + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Street3 { get => this._street3; } + + /// List of supported carriers for return shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List SupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)__datacenterAddressResponse).SupportedCarriersForReturnShipment; } + + /// Backing field for property. + private string _zip; + + /// Zip code + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Zip { get => this._zip; } + + /// Creates an new instance. + public DatacenterAddressLocationResponse() + { + this.__datacenterAddressResponse.DatacenterAddressType = "DatacenterAddressLocation"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__datacenterAddressResponse), __datacenterAddressResponse); + await eventListener.AssertObjectIsValid(nameof(__datacenterAddressResponse), __datacenterAddressResponse); + } + } + /// Datacenter address for given storage location. + public partial interface IDatacenterAddressLocationResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse + { + /// Special instruction for shipping + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Special instruction for shipping", + SerializedName = @"additionalShippingInformation", + PossibleTypes = new [] { typeof(string) })] + string AdditionalShippingInformation { get; } + /// Address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Address type", + SerializedName = @"addressType", + PossibleTypes = new [] { typeof(string) })] + string AddressType { get; } + /// City name + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"City name", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string City { get; } + /// Company name + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Company name", + SerializedName = @"company", + PossibleTypes = new [] { typeof(string) })] + string Company { get; } + /// Contact person name + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Contact person name", + SerializedName = @"contactPersonName", + PossibleTypes = new [] { typeof(string) })] + string ContactPersonName { get; } + /// name of the country + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"name of the country", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string Country { get; } + /// Phone number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Phone number", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string Phone { get; } + /// Phone extension + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Phone extension", + SerializedName = @"phoneExtension", + PossibleTypes = new [] { typeof(string) })] + string PhoneExtension { get; } + /// name of the state + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"name of the state", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; } + /// Street address line 1 + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Street address line 1", + SerializedName = @"street1", + PossibleTypes = new [] { typeof(string) })] + string Street1 { get; } + /// Street address line 2 + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Street address line 2", + SerializedName = @"street2", + PossibleTypes = new [] { typeof(string) })] + string Street2 { get; } + /// Street address line 3 + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Street address line 3", + SerializedName = @"street3", + PossibleTypes = new [] { typeof(string) })] + string Street3 { get; } + /// Zip code + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Zip code", + SerializedName = @"zip", + PossibleTypes = new [] { typeof(string) })] + string Zip { get; } + + } + /// Datacenter address for given storage location. + internal partial interface IDatacenterAddressLocationResponseInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal + { + /// Special instruction for shipping + string AdditionalShippingInformation { get; set; } + /// Address type + string AddressType { get; set; } + /// City name + string City { get; set; } + /// Company name + string Company { get; set; } + /// Contact person name + string ContactPersonName { get; set; } + /// name of the country + string Country { get; set; } + /// Phone number + string Phone { get; set; } + /// Phone extension + string PhoneExtension { get; set; } + /// name of the state + string State { get; set; } + /// Street address line 1 + string Street1 { get; set; } + /// Street address line 2 + string Street2 { get; set; } + /// Street address line 3 + string Street3 { get; set; } + /// Zip code + string Zip { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.json.cs new file mode 100644 index 00000000000..69fba457611 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressLocationResponse.json.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Datacenter address for given storage location. + public partial class DatacenterAddressLocationResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DatacenterAddressLocationResponse(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __datacenterAddressResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponse(json); + {_contactPersonName = If( json?.PropertyT("contactPersonName"), out var __jsonContactPersonName) ? (string)__jsonContactPersonName : (string)_contactPersonName;} + {_company = If( json?.PropertyT("company"), out var __jsonCompany) ? (string)__jsonCompany : (string)_company;} + {_street1 = If( json?.PropertyT("street1"), out var __jsonStreet1) ? (string)__jsonStreet1 : (string)_street1;} + {_street2 = If( json?.PropertyT("street2"), out var __jsonStreet2) ? (string)__jsonStreet2 : (string)_street2;} + {_street3 = If( json?.PropertyT("street3"), out var __jsonStreet3) ? (string)__jsonStreet3 : (string)_street3;} + {_city = If( json?.PropertyT("city"), out var __jsonCity) ? (string)__jsonCity : (string)_city;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)_state;} + {_zip = If( json?.PropertyT("zip"), out var __jsonZip) ? (string)__jsonZip : (string)_zip;} + {_country = If( json?.PropertyT("country"), out var __jsonCountry) ? (string)__jsonCountry : (string)_country;} + {_phone = If( json?.PropertyT("phone"), out var __jsonPhone) ? (string)__jsonPhone : (string)_phone;} + {_phoneExtension = If( json?.PropertyT("phoneExtension"), out var __jsonPhoneExtension) ? (string)__jsonPhoneExtension : (string)_phoneExtension;} + {_addressType = If( json?.PropertyT("addressType"), out var __jsonAddressType) ? (string)__jsonAddressType : (string)_addressType;} + {_additionalShippingInformation = If( json?.PropertyT("additionalShippingInformation"), out var __jsonAdditionalShippingInformation) ? (string)__jsonAdditionalShippingInformation : (string)_additionalShippingInformation;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressLocationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DatacenterAddressLocationResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __datacenterAddressResponse?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._contactPersonName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._contactPersonName.ToString()) : null, "contactPersonName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._company)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._company.ToString()) : null, "company" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._street1)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._street1.ToString()) : null, "street1" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._street2)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._street2.ToString()) : null, "street2" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._street3)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._street3.ToString()) : null, "street3" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._city)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._city.ToString()) : null, "city" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._zip)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._zip.ToString()) : null, "zip" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._country)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._country.ToString()) : null, "country" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._phone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._phone.ToString()) : null, "phone" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._phoneExtension)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._phoneExtension.ToString()) : null, "phoneExtension" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._addressType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._addressType.ToString()) : null, "addressType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._additionalShippingInformation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._additionalShippingInformation.ToString()) : null, "additionalShippingInformation" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.PowerShell.cs new file mode 100644 index 00000000000..c5750ef7c6c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request body to get the datacenter address. + [System.ComponentModel.TypeConverter(typeof(DatacenterAddressRequestTypeConverter))] + public partial class DatacenterAddressRequest + { + + /// + /// 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 DatacenterAddressRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)this).StorageLocation = (string) content.GetValueForProperty("StorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)this).StorageLocation, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)this).Model, 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 DatacenterAddressRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)this).StorageLocation = (string) content.GetValueForProperty("StorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)this).StorageLocation, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)this).Model, 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.DataBox.Models.IDatacenterAddressRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DatacenterAddressRequest(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.DataBox.Models.IDatacenterAddressRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DatacenterAddressRequest(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.DataBox.Models.IDatacenterAddressRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Request body to get the datacenter address. + [System.ComponentModel.TypeConverter(typeof(DatacenterAddressRequestTypeConverter))] + public partial interface IDatacenterAddressRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.TypeConverter.cs new file mode 100644 index 00000000000..682143cbcd3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DatacenterAddressRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DatacenterAddressRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DatacenterAddressRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DatacenterAddressRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.cs new file mode 100644 index 00000000000..f73442a22a0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the datacenter address. + public partial class DatacenterAddressRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal + { + + /// Backing field for property. + private string _model; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Model { get => this._model; set => this._model = value; } + + /// Backing field for property. + private string _skuName; + + /// Sku Name for which the data center address requested. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string SkuName { get => this._skuName; set => this._skuName = value; } + + /// Backing field for property. + private string _storageLocation; + + /// + /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StorageLocation { get => this._storageLocation; set => this._storageLocation = value; } + + /// Creates an new instance. + public DatacenterAddressRequest() + { + + } + } + /// Request body to get the datacenter address. + public partial interface IDatacenterAddressRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Sku Name for which the data center address requested. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Sku Name for which the data center address requested.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string SkuName { get; set; } + /// + /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"storageLocation", + PossibleTypes = new [] { typeof(string) })] + string StorageLocation { get; set; } + + } + /// Request body to get the datacenter address. + internal partial interface IDatacenterAddressRequestInternal + + { + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Sku Name for which the data center address requested. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string SkuName { get; set; } + /// + /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + string StorageLocation { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.json.cs new file mode 100644 index 00000000000..1d3b2e6fc9f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressRequest.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the datacenter address. + public partial class DatacenterAddressRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DatacenterAddressRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_storageLocation = If( json?.PropertyT("storageLocation"), out var __jsonStorageLocation) ? (string)__jsonStorageLocation : (string)_storageLocation;} + {_skuName = If( json?.PropertyT("skuName"), out var __jsonSkuName) ? (string)__jsonSkuName : (string)_skuName;} + {_model = If( json?.PropertyT("model"), out var __jsonModel) ? (string)__jsonModel : (string)_model;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DatacenterAddressRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._storageLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._storageLocation.ToString()) : null, "storageLocation" ,container.Add ); + AddIf( null != (((object)this._skuName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._skuName.ToString()) : null, "skuName" ,container.Add ); + AddIf( null != (((object)this._model)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._model.ToString()) : null, "model" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.PowerShell.cs new file mode 100644 index 00000000000..01d779cd666 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Datacenter address for given storage location. + [System.ComponentModel.TypeConverter(typeof(DatacenterAddressResponseTypeConverter))] + public partial class DatacenterAddressResponse + { + + /// + /// 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 DatacenterAddressResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("SupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).SupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("SupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).SupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DataCenterAzureLocation = (string) content.GetValueForProperty("DataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DataCenterAzureLocation, 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 DatacenterAddressResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("SupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).SupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("SupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).SupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DataCenterAzureLocation = (string) content.GetValueForProperty("DataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)this).DataCenterAzureLocation, 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.DataBox.Models.IDatacenterAddressResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DatacenterAddressResponse(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.DataBox.Models.IDatacenterAddressResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DatacenterAddressResponse(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.DataBox.Models.IDatacenterAddressResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Datacenter address for given storage location. + [System.ComponentModel.TypeConverter(typeof(DatacenterAddressResponseTypeConverter))] + public partial interface IDatacenterAddressResponse + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.TypeConverter.cs new file mode 100644 index 00000000000..7d9addf99f7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DatacenterAddressResponseTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DatacenterAddressResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DatacenterAddressResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DatacenterAddressResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.cs new file mode 100644 index 00000000000..b978c5df4da --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Datacenter address for given storage location. + public partial class DatacenterAddressResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal + { + + /// Backing field for property. + private string _dataCenterAzureLocation; + + /// Azure Location where the Data Center serves primarily. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DataCenterAzureLocation { get => this._dataCenterAzureLocation; } + + /// Backing field for property. + private string _datacenterAddressType; + + /// Data center address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DatacenterAddressType { get => this._datacenterAddressType; set => this._datacenterAddressType = value; } + + /// Internal Acessors for DataCenterAzureLocation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal.DataCenterAzureLocation { get => this._dataCenterAzureLocation; set { {_dataCenterAzureLocation = value;} } } + + /// Internal Acessors for SupportedCarriersForReturnShipment + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal.SupportedCarriersForReturnShipment { get => this._supportedCarriersForReturnShipment; set { {_supportedCarriersForReturnShipment = value;} } } + + /// Backing field for property. + private System.Collections.Generic.List _supportedCarriersForReturnShipment; + + /// List of supported carriers for return shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List SupportedCarriersForReturnShipment { get => this._supportedCarriersForReturnShipment; } + + /// Creates an new instance. + public DatacenterAddressResponse() + { + + } + } + /// Datacenter address for given storage location. + public partial interface IDatacenterAddressResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Azure Location where the Data Center serves primarily. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Azure Location where the Data Center serves primarily.", + SerializedName = @"dataCenterAzureLocation", + PossibleTypes = new [] { typeof(string) })] + string DataCenterAzureLocation { get; } + /// Data center address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Data center address type", + SerializedName = @"datacenterAddressType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DatacenterAddressLocation", "DatacenterAddressInstruction")] + string DatacenterAddressType { get; set; } + /// List of supported carriers for return shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of supported carriers for return shipment.", + SerializedName = @"supportedCarriersForReturnShipment", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SupportedCarriersForReturnShipment { get; } + + } + /// Datacenter address for given storage location. + internal partial interface IDatacenterAddressResponseInternal + + { + /// Azure Location where the Data Center serves primarily. + string DataCenterAzureLocation { get; set; } + /// Data center address type + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DatacenterAddressLocation", "DatacenterAddressInstruction")] + string DatacenterAddressType { get; set; } + /// List of supported carriers for return shipment. + System.Collections.Generic.List SupportedCarriersForReturnShipment { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.json.cs new file mode 100644 index 00000000000..c7dc0aedee9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DatacenterAddressResponse.json.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Datacenter address for given storage location. + public partial class DatacenterAddressResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DatacenterAddressResponse(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_datacenterAddressType = If( json?.PropertyT("datacenterAddressType"), out var __jsonDatacenterAddressType) ? (string)__jsonDatacenterAddressType : (string)_datacenterAddressType;} + {_supportedCarriersForReturnShipment = If( json?.PropertyT("supportedCarriersForReturnShipment"), out var __jsonSupportedCarriersForReturnShipment) ? If( __jsonSupportedCarriersForReturnShipment as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _supportedCarriersForReturnShipment;} + {_dataCenterAzureLocation = If( json?.PropertyT("dataCenterAzureLocation"), out var __jsonDataCenterAzureLocation) ? (string)__jsonDataCenterAzureLocation : (string)_dataCenterAzureLocation;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse interface is polymorphic, and the + /// precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("datacenterAddressType") ) + { + case "DatacenterAddressInstruction": + { + return new DatacenterAddressInstructionResponse(json); + } + case "DatacenterAddressLocation": + { + return new DatacenterAddressLocationResponse(json); + } + } + return new DatacenterAddressResponse(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._datacenterAddressType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._datacenterAddressType.ToString()) : null, "datacenterAddressType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._supportedCarriersForReturnShipment) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._supportedCarriersForReturnShipment ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("supportedCarriersForReturnShipment",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._dataCenterAzureLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._dataCenterAzureLocation.ToString()) : null, "dataCenterAzureLocation" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.PowerShell.cs new file mode 100644 index 00000000000..a4ecf65fd66 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Dc access security code + [System.ComponentModel.TypeConverter(typeof(DcAccessSecurityCodeTypeConverter))] + public partial class DcAccessSecurityCode + { + + /// + /// 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 DcAccessSecurityCode(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)this).ReverseDcAccessCode = (string) content.GetValueForProperty("ReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)this).ReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("ForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)this).ForwardDcAccessCode = (string) content.GetValueForProperty("ForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)this).ForwardDcAccessCode, 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 DcAccessSecurityCode(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)this).ReverseDcAccessCode = (string) content.GetValueForProperty("ReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)this).ReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("ForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)this).ForwardDcAccessCode = (string) content.GetValueForProperty("ForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)this).ForwardDcAccessCode, 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.DataBox.Models.IDcAccessSecurityCode DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DcAccessSecurityCode(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.DataBox.Models.IDcAccessSecurityCode DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DcAccessSecurityCode(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.DataBox.Models.IDcAccessSecurityCode FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Dc access security code + [System.ComponentModel.TypeConverter(typeof(DcAccessSecurityCodeTypeConverter))] + public partial interface IDcAccessSecurityCode + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.TypeConverter.cs new file mode 100644 index 00000000000..19abdf9542b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DcAccessSecurityCodeTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DcAccessSecurityCode.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DcAccessSecurityCode.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DcAccessSecurityCode.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.cs new file mode 100644 index 00000000000..e13b2581f7d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Dc access security code + public partial class DcAccessSecurityCode : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal + { + + /// Backing field for property. + private string _forwardDcAccessCode; + + /// Forward Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ForwardDcAccessCode { get => this._forwardDcAccessCode; set => this._forwardDcAccessCode = value; } + + /// Backing field for property. + private string _reverseDcAccessCode; + + /// Reverse Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ReverseDcAccessCode { get => this._reverseDcAccessCode; set => this._reverseDcAccessCode = value; } + + /// Creates an new instance. + public DcAccessSecurityCode() + { + + } + } + /// Dc access security code + public partial interface IDcAccessSecurityCode : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Forward Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Forward Dc access security code.", + SerializedName = @"forwardDCAccessCode", + PossibleTypes = new [] { typeof(string) })] + string ForwardDcAccessCode { get; set; } + /// Reverse Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Reverse Dc access security code.", + SerializedName = @"reverseDCAccessCode", + PossibleTypes = new [] { typeof(string) })] + string ReverseDcAccessCode { get; set; } + + } + /// Dc access security code + internal partial interface IDcAccessSecurityCodeInternal + + { + /// Forward Dc access security code. + string ForwardDcAccessCode { get; set; } + /// Reverse Dc access security code. + string ReverseDcAccessCode { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.json.cs new file mode 100644 index 00000000000..5393e048bf7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DcAccessSecurityCode.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Dc access security code + public partial class DcAccessSecurityCode + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DcAccessSecurityCode(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_reverseDcAccessCode = If( json?.PropertyT("reverseDCAccessCode"), out var __jsonReverseDcAccessCode) ? (string)__jsonReverseDcAccessCode : (string)_reverseDcAccessCode;} + {_forwardDcAccessCode = If( json?.PropertyT("forwardDCAccessCode"), out var __jsonForwardDcAccessCode) ? (string)__jsonForwardDcAccessCode : (string)_forwardDcAccessCode;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DcAccessSecurityCode(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._reverseDcAccessCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._reverseDcAccessCode.ToString()) : null, "reverseDCAccessCode" ,container.Add ); + AddIf( null != (((object)this._forwardDcAccessCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._forwardDcAccessCode.ToString()) : null, "forwardDCAccessCode" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.PowerShell.cs new file mode 100644 index 00000000000..f8244764e94 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(DetailsTypeConverter))] + public partial class Details + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Details(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.DataBox.Models.IDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Details(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Details(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetailsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetailsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetailsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetailsInternal)this).Message, 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 Details(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetailsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetailsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetailsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetailsInternal)this).Message, global::System.Convert.ToString); + } + AfterDeserializePSObject(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.DataBox.Models.IDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(DetailsTypeConverter))] + public partial interface IDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.TypeConverter.cs new file mode 100644 index 00000000000..a6cd51433a4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Details.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Details.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Details.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.cs new file mode 100644 index 00000000000..d15fe03f952 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class Details : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetailsInternal + { + + /// Backing field for property. + private string _code; + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Code { get => this._code; set => this._code = value; } + + /// Backing field for property. + private string _message; + + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Creates an new instance. + public Details() + { + + } + } + public partial interface IDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + + } + internal partial interface IDetailsInternal + + { + /// Error code. + string Code { get; set; } + /// Error message. + string Message { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.json.cs new file mode 100644 index 00000000000..8eb3ed74ee0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Details.json.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class Details + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal Details(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + 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;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetails. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetails. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new Details(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.PowerShell.cs new file mode 100644 index 00000000000..b39b2aedd43 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Device capability details for a given sku for a given region. + [System.ComponentModel.TypeConverter(typeof(DeviceCapabilityDetailsTypeConverter))] + public partial class DeviceCapabilityDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DeviceCapabilityDetails(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.DataBox.Models.IDeviceCapabilityDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DeviceCapabilityDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DeviceCapabilityDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetailsInternal)this).HardwareEncryption = (string) content.GetValueForProperty("HardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetailsInternal)this).HardwareEncryption, 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 DeviceCapabilityDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetailsInternal)this).HardwareEncryption = (string) content.GetValueForProperty("HardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetailsInternal)this).HardwareEncryption, global::System.Convert.ToString); + } + AfterDeserializePSObject(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.DataBox.Models.IDeviceCapabilityDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Device capability details for a given sku for a given region. + [System.ComponentModel.TypeConverter(typeof(DeviceCapabilityDetailsTypeConverter))] + public partial interface IDeviceCapabilityDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.TypeConverter.cs new file mode 100644 index 00000000000..3645edfa8bc --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DeviceCapabilityDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DeviceCapabilityDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DeviceCapabilityDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DeviceCapabilityDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.cs new file mode 100644 index 00000000000..04bdf168d68 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Device capability details for a given sku for a given region. + public partial class DeviceCapabilityDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetailsInternal + { + + /// Backing field for property. + private string _hardwareEncryption; + + /// Hardware encryption support for a given sku for a given region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string HardwareEncryption { get => this._hardwareEncryption; } + + /// Internal Acessors for HardwareEncryption + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetailsInternal.HardwareEncryption { get => this._hardwareEncryption; set { {_hardwareEncryption = value;} } } + + /// Creates an new instance. + public DeviceCapabilityDetails() + { + + } + } + /// Device capability details for a given sku for a given region. + public partial interface IDeviceCapabilityDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Hardware encryption support for a given sku for a given region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Hardware encryption support for a given sku for a given region.", + SerializedName = @"hardwareEncryption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string HardwareEncryption { get; } + + } + /// Device capability details for a given sku for a given region. + internal partial interface IDeviceCapabilityDetailsInternal + + { + /// Hardware encryption support for a given sku for a given region. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string HardwareEncryption { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.json.cs new file mode 100644 index 00000000000..30569112b28 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityDetails.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Device capability details for a given sku for a given region. + public partial class DeviceCapabilityDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DeviceCapabilityDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_hardwareEncryption = If( json?.PropertyT("hardwareEncryption"), out var __jsonHardwareEncryption) ? (string)__jsonHardwareEncryption : (string)_hardwareEncryption;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DeviceCapabilityDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._hardwareEncryption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._hardwareEncryption.ToString()) : null, "hardwareEncryption" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.PowerShell.cs new file mode 100644 index 00000000000..3c3e030c0e1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request body to get the device capabilities for given sku. + [System.ComponentModel.TypeConverter(typeof(DeviceCapabilityRequestTypeConverter))] + public partial class DeviceCapabilityRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DeviceCapabilityRequest(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.DataBox.Models.IDeviceCapabilityRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DeviceCapabilityRequest(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DeviceCapabilityRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal)this).Model, 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 DeviceCapabilityRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal)this).Model, global::System.Convert.ToString); + } + AfterDeserializePSObject(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.DataBox.Models.IDeviceCapabilityRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Request body to get the device capabilities for given sku. + [System.ComponentModel.TypeConverter(typeof(DeviceCapabilityRequestTypeConverter))] + public partial interface IDeviceCapabilityRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.TypeConverter.cs new file mode 100644 index 00000000000..d3a76459a33 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DeviceCapabilityRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DeviceCapabilityRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DeviceCapabilityRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DeviceCapabilityRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.cs new file mode 100644 index 00000000000..3ad8815ae99 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the device capabilities for given sku. + public partial class DeviceCapabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal + { + + /// Backing field for property. + private string _model; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Model { get => this._model; set => this._model = value; } + + /// Backing field for property. + private string _skuName; + + /// Type of the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string SkuName { get => this._skuName; set => this._skuName = value; } + + /// Creates an new instance. + public DeviceCapabilityRequest() + { + + } + } + /// Request body to get the device capabilities for given sku. + public partial interface IDeviceCapabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Type of the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the device.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string SkuName { get; set; } + + } + /// Request body to get the device capabilities for given sku. + internal partial interface IDeviceCapabilityRequestInternal + + { + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Type of the device. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string SkuName { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.json.cs new file mode 100644 index 00000000000..99956d40acf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the device capabilities for given sku. + public partial class DeviceCapabilityRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DeviceCapabilityRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_skuName = If( json?.PropertyT("skuName"), out var __jsonSkuName) ? (string)__jsonSkuName : (string)_skuName;} + {_model = If( json?.PropertyT("model"), out var __jsonModel) ? (string)__jsonModel : (string)_model;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DeviceCapabilityRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._skuName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._skuName.ToString()) : null, "skuName" ,container.Add ); + AddIf( null != (((object)this._model)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._model.ToString()) : null, "model" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.PowerShell.cs new file mode 100644 index 00000000000..117e277d2a3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Device capabilities for given sku in a region + [System.ComponentModel.TypeConverter(typeof(DeviceCapabilityResponseTypeConverter))] + public partial class DeviceCapabilityResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DeviceCapabilityResponse(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.DataBox.Models.IDeviceCapabilityResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DeviceCapabilityResponse(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DeviceCapabilityResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeviceCapabilityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponseInternal)this).DeviceCapabilityDetail = (System.Collections.Generic.List) content.GetValueForProperty("DeviceCapabilityDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponseInternal)this).DeviceCapabilityDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DeviceCapabilityResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeviceCapabilityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponseInternal)this).DeviceCapabilityDetail = (System.Collections.Generic.List) content.GetValueForProperty("DeviceCapabilityDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponseInternal)this).DeviceCapabilityDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(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.DataBox.Models.IDeviceCapabilityResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Device capabilities for given sku in a region + [System.ComponentModel.TypeConverter(typeof(DeviceCapabilityResponseTypeConverter))] + public partial interface IDeviceCapabilityResponse + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.TypeConverter.cs new file mode 100644 index 00000000000..94e2cf2721f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DeviceCapabilityResponseTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DeviceCapabilityResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DeviceCapabilityResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DeviceCapabilityResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.cs new file mode 100644 index 00000000000..0103ec7652a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Device capabilities for given sku in a region + public partial class DeviceCapabilityResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponseInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _deviceCapabilityDetail; + + /// List of device capabilities available for a given region and a given sku + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List DeviceCapabilityDetail { get => this._deviceCapabilityDetail; } + + /// Internal Acessors for DeviceCapabilityDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponseInternal.DeviceCapabilityDetail { get => this._deviceCapabilityDetail; set { {_deviceCapabilityDetail = value;} } } + + /// Creates an new instance. + public DeviceCapabilityResponse() + { + + } + } + /// Device capabilities for given sku in a region + public partial interface IDeviceCapabilityResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// List of device capabilities available for a given region and a given sku + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of device capabilities available for a given region and a given sku", + SerializedName = @"deviceCapabilityDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetails) })] + System.Collections.Generic.List DeviceCapabilityDetail { get; } + + } + /// Device capabilities for given sku in a region + internal partial interface IDeviceCapabilityResponseInternal + + { + /// List of device capabilities available for a given region and a given sku + System.Collections.Generic.List DeviceCapabilityDetail { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.json.cs new file mode 100644 index 00000000000..b843eb2de1d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceCapabilityResponse.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Device capabilities for given sku in a region + public partial class DeviceCapabilityResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DeviceCapabilityResponse(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_deviceCapabilityDetail = If( json?.PropertyT("deviceCapabilityDetails"), out var __jsonDeviceCapabilityDetails) ? If( __jsonDeviceCapabilityDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDeviceCapabilityDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityDetails.FromJson(__u) )) ))() : null : _deviceCapabilityDetail;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DeviceCapabilityResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._deviceCapabilityDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._deviceCapabilityDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("deviceCapabilityDetails",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.PowerShell.cs new file mode 100644 index 00000000000..a07dfb765b5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// Device erasure details with erasure completion status, secure erasure sas key and erasureordestructionlog sas key + /// + [System.ComponentModel.TypeConverter(typeof(DeviceErasureDetailsTypeConverter))] + public partial class DeviceErasureDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DeviceErasureDetails(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.DataBox.Models.IDeviceErasureDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DeviceErasureDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DeviceErasureDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeviceErasureStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)this).DeviceErasureStatus = (string) content.GetValueForProperty("DeviceErasureStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)this).DeviceErasureStatus, global::System.Convert.ToString); + } + if (content.Contains("ErasureOrDestructionCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)this).ErasureOrDestructionCertificateSasKey = (string) content.GetValueForProperty("ErasureOrDestructionCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)this).ErasureOrDestructionCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("SecureErasureCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)this).SecureErasureCertificateSasKey = (string) content.GetValueForProperty("SecureErasureCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)this).SecureErasureCertificateSasKey, 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 DeviceErasureDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeviceErasureStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)this).DeviceErasureStatus = (string) content.GetValueForProperty("DeviceErasureStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)this).DeviceErasureStatus, global::System.Convert.ToString); + } + if (content.Contains("ErasureOrDestructionCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)this).ErasureOrDestructionCertificateSasKey = (string) content.GetValueForProperty("ErasureOrDestructionCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)this).ErasureOrDestructionCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("SecureErasureCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)this).SecureErasureCertificateSasKey = (string) content.GetValueForProperty("SecureErasureCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)this).SecureErasureCertificateSasKey, global::System.Convert.ToString); + } + AfterDeserializePSObject(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.DataBox.Models.IDeviceErasureDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Device erasure details with erasure completion status, secure erasure sas key and erasureordestructionlog sas key + [System.ComponentModel.TypeConverter(typeof(DeviceErasureDetailsTypeConverter))] + public partial interface IDeviceErasureDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.TypeConverter.cs new file mode 100644 index 00000000000..f32be8fbfe5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DeviceErasureDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DeviceErasureDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DeviceErasureDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DeviceErasureDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.cs new file mode 100644 index 00000000000..a11d8087372 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Device erasure details with erasure completion status, secure erasure sas key and erasureordestructionlog sas key + /// + public partial class DeviceErasureDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal + { + + /// Backing field for property. + private string _deviceErasureStatus; + + /// Holds the device erasure completion status + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DeviceErasureStatus { get => this._deviceErasureStatus; } + + /// + /// Backing field for property. + /// + private string _erasureOrDestructionCertificateSasKey; + + /// Shared access key to download cleanup or destruction certificate for device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ErasureOrDestructionCertificateSasKey { get => this._erasureOrDestructionCertificateSasKey; } + + /// Internal Acessors for DeviceErasureStatus + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal.DeviceErasureStatus { get => this._deviceErasureStatus; set { {_deviceErasureStatus = value;} } } + + /// Internal Acessors for ErasureOrDestructionCertificateSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal.ErasureOrDestructionCertificateSasKey { get => this._erasureOrDestructionCertificateSasKey; set { {_erasureOrDestructionCertificateSasKey = value;} } } + + /// Internal Acessors for SecureErasureCertificateSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal.SecureErasureCertificateSasKey { get => this._secureErasureCertificateSasKey; set { {_secureErasureCertificateSasKey = value;} } } + + /// Backing field for property. + private string _secureErasureCertificateSasKey; + + /// Shared access key to download secure erasure certificate for the device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string SecureErasureCertificateSasKey { get => this._secureErasureCertificateSasKey; } + + /// Creates an new instance. + public DeviceErasureDetails() + { + + } + } + /// Device erasure details with erasure completion status, secure erasure sas key and erasureordestructionlog sas key + public partial interface IDeviceErasureDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Holds the device erasure completion status + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Holds the device erasure completion status", + SerializedName = @"deviceErasureStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "InProgress", "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", "CustomerActionPerformed")] + string DeviceErasureStatus { get; } + /// Shared access key to download cleanup or destruction certificate for device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Shared access key to download cleanup or destruction certificate for device", + SerializedName = @"erasureOrDestructionCertificateSasKey", + PossibleTypes = new [] { typeof(string) })] + string ErasureOrDestructionCertificateSasKey { get; } + /// Shared access key to download secure erasure certificate for the device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Shared access key to download secure erasure certificate for the device", + SerializedName = @"secureErasureCertificateSasKey", + PossibleTypes = new [] { typeof(string) })] + string SecureErasureCertificateSasKey { get; } + + } + /// Device erasure details with erasure completion status, secure erasure sas key and erasureordestructionlog sas key + internal partial interface IDeviceErasureDetailsInternal + + { + /// Holds the device erasure completion status + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "InProgress", "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", "CustomerActionPerformed")] + string DeviceErasureStatus { get; set; } + /// Shared access key to download cleanup or destruction certificate for device + string ErasureOrDestructionCertificateSasKey { get; set; } + /// Shared access key to download secure erasure certificate for the device + string SecureErasureCertificateSasKey { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.json.cs new file mode 100644 index 00000000000..e1c3bf28c75 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DeviceErasureDetails.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Device erasure details with erasure completion status, secure erasure sas key and erasureordestructionlog sas key + /// + public partial class DeviceErasureDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DeviceErasureDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_deviceErasureStatus = If( json?.PropertyT("deviceErasureStatus"), out var __jsonDeviceErasureStatus) ? (string)__jsonDeviceErasureStatus : (string)_deviceErasureStatus;} + {_erasureOrDestructionCertificateSasKey = If( json?.PropertyT("erasureOrDestructionCertificateSasKey"), out var __jsonErasureOrDestructionCertificateSasKey) ? (string)__jsonErasureOrDestructionCertificateSasKey : (string)_erasureOrDestructionCertificateSasKey;} + {_secureErasureCertificateSasKey = If( json?.PropertyT("secureErasureCertificateSasKey"), out var __jsonSecureErasureCertificateSasKey) ? (string)__jsonSecureErasureCertificateSasKey : (string)_secureErasureCertificateSasKey;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DeviceErasureDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._deviceErasureStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._deviceErasureStatus.ToString()) : null, "deviceErasureStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._erasureOrDestructionCertificateSasKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._erasureOrDestructionCertificateSasKey.ToString()) : null, "erasureOrDestructionCertificateSasKey" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._secureErasureCertificateSasKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._secureErasureCertificateSasKey.ToString()) : null, "secureErasureCertificateSasKey" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.PowerShell.cs new file mode 100644 index 00000000000..33b3756a7bd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.PowerShell.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request body to get the availability for scheduling disk orders. + [System.ComponentModel.TypeConverter(typeof(DiskScheduleAvailabilityRequestTypeConverter))] + public partial class DiskScheduleAvailabilityRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskScheduleAvailabilityRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DiskScheduleAvailabilityRequest(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.DataBox.Models.IDiskScheduleAvailabilityRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DiskScheduleAvailabilityRequest(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DiskScheduleAvailabilityRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ExpectedDataSizeInTeraByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskScheduleAvailabilityRequestInternal)this).ExpectedDataSizeInTeraByte = (int) content.GetValueForProperty("ExpectedDataSizeInTeraByte",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskScheduleAvailabilityRequestInternal)this).ExpectedDataSizeInTeraByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation = (string) content.GetValueForProperty("StorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model, 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 DiskScheduleAvailabilityRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ExpectedDataSizeInTeraByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskScheduleAvailabilityRequestInternal)this).ExpectedDataSizeInTeraByte = (int) content.GetValueForProperty("ExpectedDataSizeInTeraByte",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskScheduleAvailabilityRequestInternal)this).ExpectedDataSizeInTeraByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("StorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation = (string) content.GetValueForProperty("StorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model, global::System.Convert.ToString); + } + AfterDeserializePSObject(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.DataBox.Models.IDiskScheduleAvailabilityRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Request body to get the availability for scheduling disk orders. + [System.ComponentModel.TypeConverter(typeof(DiskScheduleAvailabilityRequestTypeConverter))] + public partial interface IDiskScheduleAvailabilityRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.TypeConverter.cs new file mode 100644 index 00000000000..55a03856f2a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DiskScheduleAvailabilityRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskScheduleAvailabilityRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskScheduleAvailabilityRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DiskScheduleAvailabilityRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DiskScheduleAvailabilityRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DiskScheduleAvailabilityRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.cs new file mode 100644 index 00000000000..eeb9a5f8ce0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the availability for scheduling disk orders. + public partial class DiskScheduleAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskScheduleAvailabilityRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskScheduleAvailabilityRequestInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest __scheduleAvailabilityRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityRequest(); + + /// Country in which storage location should be supported. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Country { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).Country = value ?? null; } + + /// Backing field for property. + private int _expectedDataSizeInTeraByte; + + /// + /// The expected size of the data, which needs to be transferred in this job, in terabytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public int ExpectedDataSizeInTeraByte { get => this._expectedDataSizeInTeraByte; set => this._expectedDataSizeInTeraByte = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Model { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).Model; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).Model = value ?? null; } + + /// Sku Name for which the order is to be scheduled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string SkuName { get => "DataBoxDisk"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).SkuName = "DataBoxDisk"; } + + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StorageLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).StorageLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).StorageLocation = value ; } + + /// Creates an new instance. + public DiskScheduleAvailabilityRequest() + { + this.__scheduleAvailabilityRequest.SkuName = "DataBoxDisk"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__scheduleAvailabilityRequest), __scheduleAvailabilityRequest); + await eventListener.AssertObjectIsValid(nameof(__scheduleAvailabilityRequest), __scheduleAvailabilityRequest); + } + } + /// Request body to get the availability for scheduling disk orders. + public partial interface IDiskScheduleAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest + { + /// + /// The expected size of the data, which needs to be transferred in this job, in terabytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The expected size of the data, which needs to be transferred in this job, in terabytes.", + SerializedName = @"expectedDataSizeInTeraBytes", + PossibleTypes = new [] { typeof(int) })] + int ExpectedDataSizeInTeraByte { get; set; } + + } + /// Request body to get the availability for scheduling disk orders. + internal partial interface IDiskScheduleAvailabilityRequestInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal + { + /// + /// The expected size of the data, which needs to be transferred in this job, in terabytes. + /// + int ExpectedDataSizeInTeraByte { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.json.cs new file mode 100644 index 00000000000..42f905c9ce4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskScheduleAvailabilityRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the availability for scheduling disk orders. + public partial class DiskScheduleAvailabilityRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DiskScheduleAvailabilityRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __scheduleAvailabilityRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityRequest(json); + {_expectedDataSizeInTeraByte = If( json?.PropertyT("expectedDataSizeInTeraBytes"), out var __jsonExpectedDataSizeInTeraBytes) ? (int)__jsonExpectedDataSizeInTeraBytes : _expectedDataSizeInTeraByte;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskScheduleAvailabilityRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskScheduleAvailabilityRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskScheduleAvailabilityRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DiskScheduleAvailabilityRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __scheduleAvailabilityRequest?.ToJson(container, serializationMode); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber(this._expectedDataSizeInTeraByte), "expectedDataSizeInTeraBytes" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.PowerShell.cs new file mode 100644 index 00000000000..e61407db8cd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Contains all the secrets of a Disk. + [System.ComponentModel.TypeConverter(typeof(DiskSecretTypeConverter))] + public partial class DiskSecret + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecret DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DiskSecret(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.DataBox.Models.IDiskSecret DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DiskSecret(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DiskSecret(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskSerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecretInternal)this).DiskSerialNumber = (string) content.GetValueForProperty("DiskSerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecretInternal)this).DiskSerialNumber, global::System.Convert.ToString); + } + if (content.Contains("BitLockerKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecretInternal)this).BitLockerKey = (string) content.GetValueForProperty("BitLockerKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecretInternal)this).BitLockerKey, 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 DiskSecret(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskSerialNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecretInternal)this).DiskSerialNumber = (string) content.GetValueForProperty("DiskSerialNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecretInternal)this).DiskSerialNumber, global::System.Convert.ToString); + } + if (content.Contains("BitLockerKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecretInternal)this).BitLockerKey = (string) content.GetValueForProperty("BitLockerKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecretInternal)this).BitLockerKey, global::System.Convert.ToString); + } + AfterDeserializePSObject(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.DataBox.Models.IDiskSecret FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Contains all the secrets of a Disk. + [System.ComponentModel.TypeConverter(typeof(DiskSecretTypeConverter))] + public partial interface IDiskSecret + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.TypeConverter.cs new file mode 100644 index 00000000000..a15ba326f71 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DiskSecretTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecret ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecret).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DiskSecret.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DiskSecret.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DiskSecret.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.cs new file mode 100644 index 00000000000..eb672854c49 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Contains all the secrets of a Disk. + public partial class DiskSecret : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecret, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecretInternal + { + + /// Backing field for property. + private string _bitLockerKey; + + /// Bit Locker key of the disk which can be used to unlock the disk to copy data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string BitLockerKey { get => this._bitLockerKey; } + + /// Backing field for property. + private string _diskSerialNumber; + + /// Serial number of the assigned disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DiskSerialNumber { get => this._diskSerialNumber; } + + /// Internal Acessors for BitLockerKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecretInternal.BitLockerKey { get => this._bitLockerKey; set { {_bitLockerKey = value;} } } + + /// Internal Acessors for DiskSerialNumber + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecretInternal.DiskSerialNumber { get => this._diskSerialNumber; set { {_diskSerialNumber = value;} } } + + /// Creates an new instance. + public DiskSecret() + { + + } + } + /// Contains all the secrets of a Disk. + public partial interface IDiskSecret : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Bit Locker key of the disk which can be used to unlock the disk to copy data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Bit Locker key of the disk which can be used to unlock the disk to copy data.", + SerializedName = @"bitLockerKey", + PossibleTypes = new [] { typeof(string) })] + string BitLockerKey { get; } + /// Serial number of the assigned disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Serial number of the assigned disk.", + SerializedName = @"diskSerialNumber", + PossibleTypes = new [] { typeof(string) })] + string DiskSerialNumber { get; } + + } + /// Contains all the secrets of a Disk. + internal partial interface IDiskSecretInternal + + { + /// Bit Locker key of the disk which can be used to unlock the disk to copy data. + string BitLockerKey { get; set; } + /// Serial number of the assigned disk. + string DiskSerialNumber { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.json.cs new file mode 100644 index 00000000000..db056a02682 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/DiskSecret.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Contains all the secrets of a Disk. + public partial class DiskSecret + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal DiskSecret(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskSerialNumber = If( json?.PropertyT("diskSerialNumber"), out var __jsonDiskSerialNumber) ? (string)__jsonDiskSerialNumber : (string)_diskSerialNumber;} + {_bitLockerKey = If( json?.PropertyT("bitLockerKey"), out var __jsonBitLockerKey) ? (string)__jsonBitLockerKey : (string)_bitLockerKey;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecret. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecret. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDiskSecret FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new DiskSecret(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._diskSerialNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._diskSerialNumber.ToString()) : null, "diskSerialNumber" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._bitLockerKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._bitLockerKey.ToString()) : null, "bitLockerKey" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.PowerShell.cs new file mode 100644 index 00000000000..9223aff2766 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Preferences related to the Encryption. + [System.ComponentModel.TypeConverter(typeof(EncryptionPreferencesTypeConverter))] + public partial class EncryptionPreferences + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EncryptionPreferences(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.DataBox.Models.IEncryptionPreferences DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EncryptionPreferences(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EncryptionPreferences(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal)this).DoubleEncryption = (string) content.GetValueForProperty("DoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal)this).DoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("HardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal)this).HardwareEncryption = (string) content.GetValueForProperty("HardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal)this).HardwareEncryption, 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 EncryptionPreferences(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal)this).DoubleEncryption = (string) content.GetValueForProperty("DoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal)this).DoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("HardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal)this).HardwareEncryption = (string) content.GetValueForProperty("HardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal)this).HardwareEncryption, global::System.Convert.ToString); + } + AfterDeserializePSObject(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.DataBox.Models.IEncryptionPreferences FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Preferences related to the Encryption. + [System.ComponentModel.TypeConverter(typeof(EncryptionPreferencesTypeConverter))] + public partial interface IEncryptionPreferences + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.TypeConverter.cs new file mode 100644 index 00000000000..7c3ddb6bf29 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EncryptionPreferencesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EncryptionPreferences.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EncryptionPreferences.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EncryptionPreferences.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.cs new file mode 100644 index 00000000000..e80ff8bc033 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Preferences related to the Encryption. + public partial class EncryptionPreferences : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal + { + + /// Backing field for property. + private string _doubleEncryption; + + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DoubleEncryption { get => this._doubleEncryption; set => this._doubleEncryption = value; } + + /// Backing field for property. + private string _hardwareEncryption; + + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string HardwareEncryption { get => this._hardwareEncryption; set => this._hardwareEncryption = value; } + + /// Creates an new instance. + public EncryptionPreferences() + { + + } + } + /// Preferences related to the Encryption. + public partial interface IEncryptionPreferences : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Defines secondary layer of software-based encryption enablement.", + SerializedName = @"doubleEncryption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string DoubleEncryption { get; set; } + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Defines Hardware level encryption (Only for disk)", + SerializedName = @"hardwareEncryption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string HardwareEncryption { get; set; } + + } + /// Preferences related to the Encryption. + internal partial interface IEncryptionPreferencesInternal + + { + /// Defines secondary layer of software-based encryption enablement. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string DoubleEncryption { get; set; } + /// Defines Hardware level encryption (Only for disk) + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string HardwareEncryption { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.json.cs new file mode 100644 index 00000000000..35929716b5b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/EncryptionPreferences.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Preferences related to the Encryption. + public partial class EncryptionPreferences + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal EncryptionPreferences(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_doubleEncryption = If( json?.PropertyT("doubleEncryption"), out var __jsonDoubleEncryption) ? (string)__jsonDoubleEncryption : (string)_doubleEncryption;} + {_hardwareEncryption = If( json?.PropertyT("hardwareEncryption"), out var __jsonHardwareEncryption) ? (string)__jsonHardwareEncryption : (string)_hardwareEncryption;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new EncryptionPreferences(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._doubleEncryption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._doubleEncryption.ToString()) : null, "doubleEncryption" ,container.Add ); + AddIf( null != (((object)this._hardwareEncryption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._hardwareEncryption.ToString()) : null, "hardwareEncryption" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.PowerShell.cs new file mode 100644 index 00000000000..9cf3e3e0fcf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] + public partial class ErrorDetail + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorDetail(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.DataBox.Models.IErrorDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorDetail(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorDetail(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Target, 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 ErrorDetail(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + } + AfterDeserializePSObject(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.DataBox.Models.IErrorDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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 detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] + public partial interface IErrorDetail + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.TypeConverter.cs new file mode 100644 index 00000000000..98e4f6a8ce0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorDetailTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorDetail.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorDetail.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorDetail.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.cs new file mode 100644 index 00000000000..ad8fcec73d3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetail : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetailInternal + { + + /// Backing field for property. + private string _code; + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Code { get => this._code; set => this._code = value; } + + /// Backing field for property. + private System.Collections.Generic.List _detail; + + /// Error target. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List Detail { get => this._detail; set => this._detail = value; } + + /// Backing field for property. + private string _message; + + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Backing field for property. + private string _target; + + /// Additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Target { get => this._target; set => this._target = value; } + + /// Creates an new instance. + public ErrorDetail() + { + + } + } + /// The error detail. + public partial interface IErrorDetail : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// Error target. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Error target.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDetails) })] + System.Collections.Generic.List Detail { get; set; } + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// Additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Additional error info.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; set; } + + } + /// The error detail. + internal partial interface IErrorDetailInternal + + { + /// Error code. + string Code { get; set; } + /// Error target. + System.Collections.Generic.List Detail { get; set; } + /// Error message. + string Message { get; set; } + /// Additional error info. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.json.cs new file mode 100644 index 00000000000..516965a2b1c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ErrorDetail.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetail + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorDetail(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + 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;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Details.FromJson(__u) )) ))() : null : _detail;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)_target;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IErrorDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ErrorDetail(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + if (null != this._detail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._detail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("details",__w); + } + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.PowerShell.cs new file mode 100644 index 00000000000..d6a619fc72f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Export disk details + [System.ComponentModel.TypeConverter(typeof(ExportDiskDetailsTypeConverter))] + public partial class ExportDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExportDiskDetails(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.DataBox.Models.IExportDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExportDiskDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExportDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ManifestFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal)this).ManifestFile = (string) content.GetValueForProperty("ManifestFile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal)this).ManifestFile, global::System.Convert.ToString); + } + if (content.Contains("ManifestHash")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal)this).ManifestHash = (string) content.GetValueForProperty("ManifestHash",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal)this).ManifestHash, global::System.Convert.ToString); + } + if (content.Contains("BackupManifestCloudPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal)this).BackupManifestCloudPath = (string) content.GetValueForProperty("BackupManifestCloudPath",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal)this).BackupManifestCloudPath, 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 ExportDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ManifestFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal)this).ManifestFile = (string) content.GetValueForProperty("ManifestFile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal)this).ManifestFile, global::System.Convert.ToString); + } + if (content.Contains("ManifestHash")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal)this).ManifestHash = (string) content.GetValueForProperty("ManifestHash",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal)this).ManifestHash, global::System.Convert.ToString); + } + if (content.Contains("BackupManifestCloudPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal)this).BackupManifestCloudPath = (string) content.GetValueForProperty("BackupManifestCloudPath",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal)this).BackupManifestCloudPath, global::System.Convert.ToString); + } + AfterDeserializePSObject(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.DataBox.Models.IExportDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Export disk details + [System.ComponentModel.TypeConverter(typeof(ExportDiskDetailsTypeConverter))] + public partial interface IExportDiskDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.TypeConverter.cs new file mode 100644 index 00000000000..ed085650f86 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExportDiskDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExportDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExportDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExportDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.cs new file mode 100644 index 00000000000..251596c8f5f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Export disk details + public partial class ExportDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal + { + + /// Backing field for property. + private string _backupManifestCloudPath; + + /// Path to backed up manifest, only returned if enableManifestBackup is true. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string BackupManifestCloudPath { get => this._backupManifestCloudPath; } + + /// Backing field for property. + private string _manifestFile; + + /// The relative path of the manifest file on the disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ManifestFile { get => this._manifestFile; } + + /// Backing field for property. + private string _manifestHash; + + /// The Base16-encoded MD5 hash of the manifest file on the disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ManifestHash { get => this._manifestHash; } + + /// Internal Acessors for BackupManifestCloudPath + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal.BackupManifestCloudPath { get => this._backupManifestCloudPath; set { {_backupManifestCloudPath = value;} } } + + /// Internal Acessors for ManifestFile + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal.ManifestFile { get => this._manifestFile; set { {_manifestFile = value;} } } + + /// Internal Acessors for ManifestHash + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetailsInternal.ManifestHash { get => this._manifestHash; set { {_manifestHash = value;} } } + + /// Creates an new instance. + public ExportDiskDetails() + { + + } + } + /// Export disk details + public partial interface IExportDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Path to backed up manifest, only returned if enableManifestBackup is true. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Path to backed up manifest, only returned if enableManifestBackup is true.", + SerializedName = @"backupManifestCloudPath", + PossibleTypes = new [] { typeof(string) })] + string BackupManifestCloudPath { get; } + /// The relative path of the manifest file on the disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The relative path of the manifest file on the disk.", + SerializedName = @"manifestFile", + PossibleTypes = new [] { typeof(string) })] + string ManifestFile { get; } + /// The Base16-encoded MD5 hash of the manifest file on the disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The Base16-encoded MD5 hash of the manifest file on the disk.", + SerializedName = @"manifestHash", + PossibleTypes = new [] { typeof(string) })] + string ManifestHash { get; } + + } + /// Export disk details + internal partial interface IExportDiskDetailsInternal + + { + /// Path to backed up manifest, only returned if enableManifestBackup is true. + string BackupManifestCloudPath { get; set; } + /// The relative path of the manifest file on the disk. + string ManifestFile { get; set; } + /// The Base16-encoded MD5 hash of the manifest file on the disk. + string ManifestHash { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.json.cs new file mode 100644 index 00000000000..ea46da303d4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ExportDiskDetails.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Export disk details + public partial class ExportDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ExportDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_manifestFile = If( json?.PropertyT("manifestFile"), out var __jsonManifestFile) ? (string)__jsonManifestFile : (string)_manifestFile;} + {_manifestHash = If( json?.PropertyT("manifestHash"), out var __jsonManifestHash) ? (string)__jsonManifestHash : (string)_manifestHash;} + {_backupManifestCloudPath = If( json?.PropertyT("backupManifestCloudPath"), out var __jsonBackupManifestCloudPath) ? (string)__jsonBackupManifestCloudPath : (string)_backupManifestCloudPath;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IExportDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ExportDiskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._manifestFile)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._manifestFile.ToString()) : null, "manifestFile" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._manifestHash)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._manifestHash.ToString()) : null, "manifestHash" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._backupManifestCloudPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._backupManifestCloudPath.ToString()) : null, "backupManifestCloudPath" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.PowerShell.cs new file mode 100644 index 00000000000..972be7e5296 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Details of the filter files to be used for data transfer. + [System.ComponentModel.TypeConverter(typeof(FilterFileDetailsTypeConverter))] + public partial class FilterFileDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FilterFileDetails(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.DataBox.Models.IFilterFileDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FilterFileDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FilterFileDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FilterFileType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetailsInternal)this).FilterFileType = (string) content.GetValueForProperty("FilterFileType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetailsInternal)this).FilterFileType, global::System.Convert.ToString); + } + if (content.Contains("FilterFilePath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetailsInternal)this).FilterFilePath = (string) content.GetValueForProperty("FilterFilePath",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetailsInternal)this).FilterFilePath, 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 FilterFileDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FilterFileType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetailsInternal)this).FilterFileType = (string) content.GetValueForProperty("FilterFileType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetailsInternal)this).FilterFileType, global::System.Convert.ToString); + } + if (content.Contains("FilterFilePath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetailsInternal)this).FilterFilePath = (string) content.GetValueForProperty("FilterFilePath",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetailsInternal)this).FilterFilePath, global::System.Convert.ToString); + } + AfterDeserializePSObject(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.DataBox.Models.IFilterFileDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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(); + } + } + /// Details of the filter files to be used for data transfer. + [System.ComponentModel.TypeConverter(typeof(FilterFileDetailsTypeConverter))] + public partial interface IFilterFileDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.TypeConverter.cs new file mode 100644 index 00000000000..a5173136722 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FilterFileDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FilterFileDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FilterFileDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FilterFileDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.cs new file mode 100644 index 00000000000..5067ac9025b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details of the filter files to be used for data transfer. + public partial class FilterFileDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetailsInternal + { + + /// Backing field for property. + private string _filterFilePath; + + /// Path of the file that contains the details of all items to transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string FilterFilePath { get => this._filterFilePath; set => this._filterFilePath = value; } + + /// Backing field for property. + private string _filterFileType; + + /// Type of the filter file. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string FilterFileType { get => this._filterFileType; set => this._filterFileType = value; } + + /// Creates an new instance. + public FilterFileDetails() + { + + } + } + /// Details of the filter files to be used for data transfer. + public partial interface IFilterFileDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Path of the file that contains the details of all items to transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Path of the file that contains the details of all items to transfer.", + SerializedName = @"filterFilePath", + PossibleTypes = new [] { typeof(string) })] + string FilterFilePath { get; set; } + /// Type of the filter file. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the filter file.", + SerializedName = @"filterFileType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("AzureBlob", "AzureFile")] + string FilterFileType { get; set; } + + } + /// Details of the filter files to be used for data transfer. + internal partial interface IFilterFileDetailsInternal + + { + /// Path of the file that contains the details of all items to transfer. + string FilterFilePath { get; set; } + /// Type of the filter file. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("AzureBlob", "AzureFile")] + string FilterFileType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.json.cs new file mode 100644 index 00000000000..bfe31261608 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/FilterFileDetails.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details of the filter files to be used for data transfer. + public partial class FilterFileDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal FilterFileDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_filterFileType = If( json?.PropertyT("filterFileType"), out var __jsonFilterFileType) ? (string)__jsonFilterFileType : (string)_filterFileType;} + {_filterFilePath = If( json?.PropertyT("filterFilePath"), out var __jsonFilterFilePath) ? (string)__jsonFilterFilePath : (string)_filterFilePath;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new FilterFileDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._filterFileType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._filterFileType.ToString()) : null, "filterFileType" ,container.Add ); + AddIf( null != (((object)this._filterFilePath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._filterFilePath.ToString()) : null, "filterFilePath" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.PowerShell.cs new file mode 100644 index 00000000000..c462d76f206 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Granular Details for log generated during copy. + [System.ComponentModel.TypeConverter(typeof(GranularCopyLogDetailsTypeConverter))] + public partial class GranularCopyLogDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GranularCopyLogDetails(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.DataBox.Models.IGranularCopyLogDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GranularCopyLogDetails(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.DataBox.Models.IGranularCopyLogDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GranularCopyLogDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CopyLogDetailsType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetailsInternal)this).CopyLogDetailsType = (string) content.GetValueForProperty("CopyLogDetailsType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetailsInternal)this).CopyLogDetailsType, 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 GranularCopyLogDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CopyLogDetailsType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetailsInternal)this).CopyLogDetailsType = (string) content.GetValueForProperty("CopyLogDetailsType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetailsInternal)this).CopyLogDetailsType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Granular Details for log generated during copy. + [System.ComponentModel.TypeConverter(typeof(GranularCopyLogDetailsTypeConverter))] + public partial interface IGranularCopyLogDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.TypeConverter.cs new file mode 100644 index 00000000000..ffec9f0e0a1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GranularCopyLogDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GranularCopyLogDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GranularCopyLogDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GranularCopyLogDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.cs new file mode 100644 index 00000000000..13bffc0d518 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Granular Details for log generated during copy. + public partial class GranularCopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetailsInternal + { + + /// Backing field for property. + private string _copyLogDetailsType; + + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CopyLogDetailsType { get => this._copyLogDetailsType; set => this._copyLogDetailsType = value; } + + /// Creates an new instance. + public GranularCopyLogDetails() + { + + } + } + /// Granular Details for log generated during copy. + public partial interface IGranularCopyLogDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates the type of job details.", + SerializedName = @"copyLogDetailsType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string CopyLogDetailsType { get; set; } + + } + /// Granular Details for log generated during copy. + internal partial interface IGranularCopyLogDetailsInternal + + { + /// Indicates the type of job details. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string CopyLogDetailsType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.json.cs new file mode 100644 index 00000000000..c98af30e734 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyLogDetails.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Granular Details for log generated during copy. + public partial class GranularCopyLogDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetails interface is polymorphic, and the + /// precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyLogDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("copyLogDetailsType") ) + { + case "DataBoxCustomerDisk": + { + return new DataBoxDiskGranularCopyLogDetails(json); + } + } + return new GranularCopyLogDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal GranularCopyLogDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_copyLogDetailsType = If( json?.PropertyT("copyLogDetailsType"), out var __jsonCopyLogDetailsType) ? (string)__jsonCopyLogDetailsType : (string)_copyLogDetailsType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._copyLogDetailsType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._copyLogDetailsType.ToString()) : null, "copyLogDetailsType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.PowerShell.cs new file mode 100644 index 00000000000..eaa594f5c2a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.PowerShell.cs @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Granular Copy progress. + [System.ComponentModel.TypeConverter(typeof(GranularCopyProgressTypeConverter))] + public partial class GranularCopyProgress + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgress DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GranularCopyProgress(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.DataBox.Models.IGranularCopyProgress DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GranularCopyProgress(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.DataBox.Models.IGranularCopyProgress FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GranularCopyProgress(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("StorageAccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).StorageAccountName = (string) content.GetValueForProperty("StorageAccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).StorageAccountName, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AccountId = (string) content.GetValueForProperty("AccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AccountId, global::System.Convert.ToString); + } + if (content.Contains("BytesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).BytesProcessed = (long?) content.GetValueForProperty("BytesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).BytesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBytesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalBytesToProcess = (long?) content.GetValueForProperty("TotalBytesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalBytesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesProcessed = (long?) content.GetValueForProperty("FilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalFilesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalFilesToProcess = (long?) content.GetValueForProperty("TotalFilesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalFilesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFilesProcessed = (long?) content.GetValueForProperty("InvalidFilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFileBytesUploaded")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFileBytesUploaded = (long?) content.GetValueForProperty("InvalidFileBytesUploaded",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFileBytesUploaded, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RenamedContainerCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).RenamedContainerCount = (long?) content.GetValueForProperty("RenamedContainerCount",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).RenamedContainerCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesErroredOut = (long?) content.GetValueForProperty("FilesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DirectoriesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DirectoriesErroredOut = (long?) content.GetValueForProperty("DirectoriesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DirectoriesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidDirectoriesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidDirectoriesProcessed = (long?) content.GetValueForProperty("InvalidDirectoriesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidDirectoriesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IsEnumerationInProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).IsEnumerationInProgress = (bool?) content.GetValueForProperty("IsEnumerationInProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).IsEnumerationInProgress, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Target, 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 GranularCopyProgress(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("StorageAccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).StorageAccountName = (string) content.GetValueForProperty("StorageAccountName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).StorageAccountName, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("AccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AccountId = (string) content.GetValueForProperty("AccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AccountId, global::System.Convert.ToString); + } + if (content.Contains("BytesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).BytesProcessed = (long?) content.GetValueForProperty("BytesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).BytesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalBytesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalBytesToProcess = (long?) content.GetValueForProperty("TotalBytesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalBytesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesProcessed = (long?) content.GetValueForProperty("FilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalFilesToProcess")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalFilesToProcess = (long?) content.GetValueForProperty("TotalFilesToProcess",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).TotalFilesToProcess, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFilesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFilesProcessed = (long?) content.GetValueForProperty("InvalidFilesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFilesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidFileBytesUploaded")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFileBytesUploaded = (long?) content.GetValueForProperty("InvalidFileBytesUploaded",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidFileBytesUploaded, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("RenamedContainerCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).RenamedContainerCount = (long?) content.GetValueForProperty("RenamedContainerCount",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).RenamedContainerCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FilesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesErroredOut = (long?) content.GetValueForProperty("FilesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).FilesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DirectoriesErroredOut")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DirectoriesErroredOut = (long?) content.GetValueForProperty("DirectoriesErroredOut",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).DirectoriesErroredOut, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InvalidDirectoriesProcessed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidDirectoriesProcessed = (long?) content.GetValueForProperty("InvalidDirectoriesProcessed",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).InvalidDirectoriesProcessed, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IsEnumerationInProgress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).IsEnumerationInProgress = (bool?) content.GetValueForProperty("IsEnumerationInProgress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).IsEnumerationInProgress, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal)this).Target, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Granular Copy progress. + [System.ComponentModel.TypeConverter(typeof(GranularCopyProgressTypeConverter))] + public partial interface IGranularCopyProgress + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.TypeConverter.cs new file mode 100644 index 00000000000..63274246f7a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GranularCopyProgressTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgress ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgress).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GranularCopyProgress.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GranularCopyProgress.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GranularCopyProgress.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.cs new file mode 100644 index 00000000000..921d1bc69a2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.cs @@ -0,0 +1,552 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Granular Copy progress. + public partial class GranularCopyProgress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgress, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal + { + + /// Backing field for property. + private string _accountId; + + /// Id of the account where the data needs to be uploaded. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string AccountId { get => this._accountId; } + + /// Backing field for property. + private System.Collections.Generic.List _action; + + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List Action { get => this._action; } + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo; } + + /// Backing field for property. + private long? _bytesProcessed; + + /// To indicate bytes transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? BytesProcessed { get => this._bytesProcessed; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code; } + + /// Backing field for property. + private string _dataAccountType; + + /// Data Account Type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DataAccountType { get => this._dataAccountType; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail; } + + /// Backing field for property. + private long? _directoriesErroredOut; + + /// To indicate directories errored out in the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? DirectoriesErroredOut { get => this._directoriesErroredOut; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError _error; + + /// Error, if any, in the stage + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError()); } + + /// Backing field for property. + private long? _filesErroredOut; + + /// Number of files which could not be copied + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? FilesErroredOut { get => this._filesErroredOut; } + + /// Backing field for property. + private long? _filesProcessed; + + /// Number of files processed + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? FilesProcessed { get => this._filesProcessed; } + + /// Backing field for property. + private long? _invalidDirectoriesProcessed; + + /// To indicate directories renamed + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? InvalidDirectoriesProcessed { get => this._invalidDirectoriesProcessed; } + + /// Backing field for property. + private long? _invalidFileBytesUploaded; + + /// + /// Total amount of data not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? InvalidFileBytesUploaded { get => this._invalidFileBytesUploaded; } + + /// Backing field for property. + private long? _invalidFilesProcessed; + + /// + /// Number of files not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? InvalidFilesProcessed { get => this._invalidFilesProcessed; } + + /// Backing field for property. + private bool? _isEnumerationInProgress; + + /// + /// To indicate if enumeration of data is in progress. + /// Until this is true, the TotalBytesToProcess may not be valid. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? IsEnumerationInProgress { get => this._isEnumerationInProgress; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message; } + + /// Internal Acessors for AccountId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.AccountId { get => this._accountId; set { {_accountId = value;} } } + + /// Internal Acessors for Action + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.Action { get => this._action; set { {_action = value;} } } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for BytesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.BytesProcessed { get => this._bytesProcessed; set { {_bytesProcessed = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code = value ?? null; } + + /// Internal Acessors for DataAccountType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.DataAccountType { get => this._dataAccountType; set { {_dataAccountType = value;} } } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for DirectoriesErroredOut + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.DirectoriesErroredOut { get => this._directoriesErroredOut; set { {_directoriesErroredOut = value;} } } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError()); set { {_error = value;} } } + + /// Internal Acessors for FilesErroredOut + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.FilesErroredOut { get => this._filesErroredOut; set { {_filesErroredOut = value;} } } + + /// Internal Acessors for FilesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.FilesProcessed { get => this._filesProcessed; set { {_filesProcessed = value;} } } + + /// Internal Acessors for InvalidDirectoriesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.InvalidDirectoriesProcessed { get => this._invalidDirectoriesProcessed; set { {_invalidDirectoriesProcessed = value;} } } + + /// Internal Acessors for InvalidFileBytesUploaded + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.InvalidFileBytesUploaded { get => this._invalidFileBytesUploaded; set { {_invalidFileBytesUploaded = value;} } } + + /// Internal Acessors for InvalidFilesProcessed + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.InvalidFilesProcessed { get => this._invalidFilesProcessed; set { {_invalidFilesProcessed = value;} } } + + /// Internal Acessors for IsEnumerationInProgress + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.IsEnumerationInProgress { get => this._isEnumerationInProgress; set { {_isEnumerationInProgress = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message = value ?? null; } + + /// Internal Acessors for RenamedContainerCount + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.RenamedContainerCount { get => this._renamedContainerCount; set { {_renamedContainerCount = value;} } } + + /// Internal Acessors for StorageAccountName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.StorageAccountName { get => this._storageAccountName; set { {_storageAccountName = value;} } } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target = value ?? null; } + + /// Internal Acessors for TotalBytesToProcess + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.TotalBytesToProcess { get => this._totalBytesToProcess; set { {_totalBytesToProcess = value;} } } + + /// Internal Acessors for TotalFilesToProcess + long? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.TotalFilesToProcess { get => this._totalFilesToProcess; set { {_totalFilesToProcess = value;} } } + + /// Internal Acessors for TransferType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgressInternal.TransferType { get => this._transferType; set { {_transferType = value;} } } + + /// Backing field for property. + private long? _renamedContainerCount; + + /// + /// Number of folders not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? RenamedContainerCount { get => this._renamedContainerCount; } + + /// Backing field for property. + private string _storageAccountName; + + /// + /// Name of the storage account. This will be empty for data account types other than storage account. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StorageAccountName { get => this._storageAccountName; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target; } + + /// Backing field for property. + private long? _totalBytesToProcess; + + /// Total amount of data to be processed by the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? TotalBytesToProcess { get => this._totalBytesToProcess; } + + /// Backing field for property. + private long? _totalFilesToProcess; + + /// Total files to process + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public long? TotalFilesToProcess { get => this._totalFilesToProcess; } + + /// Backing field for property. + private string _transferType; + + /// Transfer type of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string TransferType { get => this._transferType; } + + /// Creates an new instance. + public GranularCopyProgress() + { + + } + } + /// Granular Copy progress. + public partial interface IGranularCopyProgress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Id of the account where the data needs to be uploaded. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Id of the account where the data needs to be uploaded.", + SerializedName = @"accountId", + PossibleTypes = new [] { typeof(string) })] + string AccountId { get; } + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Available actions on the job.", + SerializedName = @"actions", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + System.Collections.Generic.List Action { get; } + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets additional error info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// To indicate bytes transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"To indicate bytes transferred.", + SerializedName = @"bytesProcessed", + PossibleTypes = new [] { typeof(long) })] + long? BytesProcessed { get; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// Data Account Type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Data Account Type.", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string DataAccountType { get; } + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets details for the error.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) })] + System.Collections.Generic.List Detail { get; } + /// To indicate directories errored out in the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"To indicate directories errored out in the job.", + SerializedName = @"directoriesErroredOut", + PossibleTypes = new [] { typeof(long) })] + long? DirectoriesErroredOut { get; } + /// Number of files which could not be copied + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of files which could not be copied", + SerializedName = @"filesErroredOut", + PossibleTypes = new [] { typeof(long) })] + long? FilesErroredOut { get; } + /// Number of files processed + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of files processed", + SerializedName = @"filesProcessed", + PossibleTypes = new [] { typeof(long) })] + long? FilesProcessed { get; } + /// To indicate directories renamed + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"To indicate directories renamed", + SerializedName = @"invalidDirectoriesProcessed", + PossibleTypes = new [] { typeof(long) })] + long? InvalidDirectoriesProcessed { get; } + /// + /// Total amount of data not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total amount of data not adhering to azure naming conventions which were processed by automatic renaming", + SerializedName = @"invalidFileBytesUploaded", + PossibleTypes = new [] { typeof(long) })] + long? InvalidFileBytesUploaded { get; } + /// + /// Number of files not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of files not adhering to azure naming conventions which were processed by automatic renaming", + SerializedName = @"invalidFilesProcessed", + PossibleTypes = new [] { typeof(long) })] + long? InvalidFilesProcessed { get; } + /// + /// To indicate if enumeration of data is in progress. + /// Until this is true, the TotalBytesToProcess may not be valid. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid.", + SerializedName = @"isEnumerationInProgress", + PossibleTypes = new [] { typeof(bool) })] + bool? IsEnumerationInProgress { get; } + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message parsed from the body of the http error response.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// + /// Number of folders not adhering to azure naming conventions which were processed by automatic renaming + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of folders not adhering to azure naming conventions which were processed by automatic renaming", + SerializedName = @"renamedContainerCount", + PossibleTypes = new [] { typeof(long) })] + long? RenamedContainerCount { get; } + /// + /// Name of the storage account. This will be empty for data account types other than storage account. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the storage account. This will be empty for data account types other than storage account.", + SerializedName = @"storageAccountName", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountName { get; } + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the target of the error.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + /// Total amount of data to be processed by the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total amount of data to be processed by the job.", + SerializedName = @"totalBytesToProcess", + PossibleTypes = new [] { typeof(long) })] + long? TotalBytesToProcess { get; } + /// Total files to process + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Total files to process", + SerializedName = @"totalFilesToProcess", + PossibleTypes = new [] { typeof(long) })] + long? TotalFilesToProcess { get; } + /// Transfer type of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Transfer type of data", + SerializedName = @"transferType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; } + + } + /// Granular Copy progress. + internal partial interface IGranularCopyProgressInternal + + { + /// Id of the account where the data needs to be uploaded. + string AccountId { get; set; } + /// Available actions on the job. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + System.Collections.Generic.List Action { get; set; } + /// Gets or sets additional error info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// To indicate bytes transferred. + long? BytesProcessed { get; set; } + /// Error code. + string Code { get; set; } + /// Data Account Type. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string DataAccountType { get; set; } + /// Gets or sets details for the error. + System.Collections.Generic.List Detail { get; set; } + /// To indicate directories errored out in the job. + long? DirectoriesErroredOut { get; set; } + /// Error, if any, in the stage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get; set; } + /// Number of files which could not be copied + long? FilesErroredOut { get; set; } + /// Number of files processed + long? FilesProcessed { get; set; } + /// To indicate directories renamed + long? InvalidDirectoriesProcessed { get; set; } + /// + /// Total amount of data not adhering to azure naming conventions which were processed by automatic renaming + /// + long? InvalidFileBytesUploaded { get; set; } + /// + /// Number of files not adhering to azure naming conventions which were processed by automatic renaming + /// + long? InvalidFilesProcessed { get; set; } + /// + /// To indicate if enumeration of data is in progress. + /// Until this is true, the TotalBytesToProcess may not be valid. + /// + bool? IsEnumerationInProgress { get; set; } + /// The error message parsed from the body of the http error response. + string Message { get; set; } + /// + /// Number of folders not adhering to azure naming conventions which were processed by automatic renaming + /// + long? RenamedContainerCount { get; set; } + /// + /// Name of the storage account. This will be empty for data account types other than storage account. + /// + string StorageAccountName { get; set; } + /// Gets or sets the target of the error. + string Target { get; set; } + /// Total amount of data to be processed by the job. + long? TotalBytesToProcess { get; set; } + /// Total files to process + long? TotalFilesToProcess { get; set; } + /// Transfer type of data + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.json.cs new file mode 100644 index 00000000000..232c5478a77 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/GranularCopyProgress.json.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Granular Copy progress. + public partial class GranularCopyProgress + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgress. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgress. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IGranularCopyProgress FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new GranularCopyProgress(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal GranularCopyProgress(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError.FromJson(__jsonError) : _error;} + {_storageAccountName = If( json?.PropertyT("storageAccountName"), out var __jsonStorageAccountName) ? (string)__jsonStorageAccountName : (string)_storageAccountName;} + {_transferType = If( json?.PropertyT("transferType"), out var __jsonTransferType) ? (string)__jsonTransferType : (string)_transferType;} + {_dataAccountType = If( json?.PropertyT("dataAccountType"), out var __jsonDataAccountType) ? (string)__jsonDataAccountType : (string)_dataAccountType;} + {_accountId = If( json?.PropertyT("accountId"), out var __jsonAccountId) ? (string)__jsonAccountId : (string)_accountId;} + {_bytesProcessed = If( json?.PropertyT("bytesProcessed"), out var __jsonBytesProcessed) ? (long?)__jsonBytesProcessed : _bytesProcessed;} + {_totalBytesToProcess = If( json?.PropertyT("totalBytesToProcess"), out var __jsonTotalBytesToProcess) ? (long?)__jsonTotalBytesToProcess : _totalBytesToProcess;} + {_filesProcessed = If( json?.PropertyT("filesProcessed"), out var __jsonFilesProcessed) ? (long?)__jsonFilesProcessed : _filesProcessed;} + {_totalFilesToProcess = If( json?.PropertyT("totalFilesToProcess"), out var __jsonTotalFilesToProcess) ? (long?)__jsonTotalFilesToProcess : _totalFilesToProcess;} + {_invalidFilesProcessed = If( json?.PropertyT("invalidFilesProcessed"), out var __jsonInvalidFilesProcessed) ? (long?)__jsonInvalidFilesProcessed : _invalidFilesProcessed;} + {_invalidFileBytesUploaded = If( json?.PropertyT("invalidFileBytesUploaded"), out var __jsonInvalidFileBytesUploaded) ? (long?)__jsonInvalidFileBytesUploaded : _invalidFileBytesUploaded;} + {_renamedContainerCount = If( json?.PropertyT("renamedContainerCount"), out var __jsonRenamedContainerCount) ? (long?)__jsonRenamedContainerCount : _renamedContainerCount;} + {_filesErroredOut = If( json?.PropertyT("filesErroredOut"), out var __jsonFilesErroredOut) ? (long?)__jsonFilesErroredOut : _filesErroredOut;} + {_directoriesErroredOut = If( json?.PropertyT("directoriesErroredOut"), out var __jsonDirectoriesErroredOut) ? (long?)__jsonDirectoriesErroredOut : _directoriesErroredOut;} + {_invalidDirectoriesProcessed = If( json?.PropertyT("invalidDirectoriesProcessed"), out var __jsonInvalidDirectoriesProcessed) ? (long?)__jsonInvalidDirectoriesProcessed : _invalidDirectoriesProcessed;} + {_isEnumerationInProgress = If( json?.PropertyT("isEnumerationInProgress"), out var __jsonIsEnumerationInProgress) ? (bool?)__jsonIsEnumerationInProgress : _isEnumerationInProgress;} + {_action = If( json?.PropertyT("actions"), out var __jsonActions) ? If( __jsonActions as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _action;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._storageAccountName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._storageAccountName.ToString()) : null, "storageAccountName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._transferType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._transferType.ToString()) : null, "transferType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._dataAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._dataAccountType.ToString()) : null, "dataAccountType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._accountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._accountId.ToString()) : null, "accountId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._bytesProcessed ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._bytesProcessed) : null, "bytesProcessed" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalBytesToProcess ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._totalBytesToProcess) : null, "totalBytesToProcess" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._filesProcessed ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._filesProcessed) : null, "filesProcessed" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._totalFilesToProcess ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._totalFilesToProcess) : null, "totalFilesToProcess" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._invalidFilesProcessed ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._invalidFilesProcessed) : null, "invalidFilesProcessed" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._invalidFileBytesUploaded ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._invalidFileBytesUploaded) : null, "invalidFileBytesUploaded" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._renamedContainerCount ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._renamedContainerCount) : null, "renamedContainerCount" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._filesErroredOut ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._filesErroredOut) : null, "filesErroredOut" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._directoriesErroredOut ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._directoriesErroredOut) : null, "directoriesErroredOut" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._invalidDirectoriesProcessed ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((long)this._invalidDirectoriesProcessed) : null, "invalidDirectoriesProcessed" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._isEnumerationInProgress ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._isEnumerationInProgress) : null, "isEnumerationInProgress" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._action) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._action ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("actions",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.PowerShell.cs new file mode 100644 index 00000000000..2febf7a91a4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request body to get the availability for scheduling heavy orders. + [System.ComponentModel.TypeConverter(typeof(HeavyScheduleAvailabilityRequestTypeConverter))] + public partial class HeavyScheduleAvailabilityRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IHeavyScheduleAvailabilityRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HeavyScheduleAvailabilityRequest(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.DataBox.Models.IHeavyScheduleAvailabilityRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HeavyScheduleAvailabilityRequest(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.DataBox.Models.IHeavyScheduleAvailabilityRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HeavyScheduleAvailabilityRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation = (string) content.GetValueForProperty("StorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model, 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 HeavyScheduleAvailabilityRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation = (string) content.GetValueForProperty("StorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Request body to get the availability for scheduling heavy orders. + [System.ComponentModel.TypeConverter(typeof(HeavyScheduleAvailabilityRequestTypeConverter))] + public partial interface IHeavyScheduleAvailabilityRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.TypeConverter.cs new file mode 100644 index 00000000000..4c1905847a0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HeavyScheduleAvailabilityRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IHeavyScheduleAvailabilityRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IHeavyScheduleAvailabilityRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HeavyScheduleAvailabilityRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HeavyScheduleAvailabilityRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HeavyScheduleAvailabilityRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.cs new file mode 100644 index 00000000000..c8bbb888d8a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the availability for scheduling heavy orders. + public partial class HeavyScheduleAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IHeavyScheduleAvailabilityRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IHeavyScheduleAvailabilityRequestInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest __scheduleAvailabilityRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityRequest(); + + /// Country in which storage location should be supported. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Country { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).Country = value ?? null; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Model { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).Model; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).Model = value ?? null; } + + /// Sku Name for which the order is to be scheduled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string SkuName { get => "DataBoxHeavy"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).SkuName = "DataBoxHeavy"; } + + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string StorageLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).StorageLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)__scheduleAvailabilityRequest).StorageLocation = value ; } + + /// Creates an new instance. + public HeavyScheduleAvailabilityRequest() + { + this.__scheduleAvailabilityRequest.SkuName = "DataBoxHeavy"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__scheduleAvailabilityRequest), __scheduleAvailabilityRequest); + await eventListener.AssertObjectIsValid(nameof(__scheduleAvailabilityRequest), __scheduleAvailabilityRequest); + } + } + /// Request body to get the availability for scheduling heavy orders. + public partial interface IHeavyScheduleAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest + { + + } + /// Request body to get the availability for scheduling heavy orders. + internal partial interface IHeavyScheduleAvailabilityRequestInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.json.cs new file mode 100644 index 00000000000..8094f8e43f7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/HeavyScheduleAvailabilityRequest.json.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the availability for scheduling heavy orders. + public partial class HeavyScheduleAvailabilityRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IHeavyScheduleAvailabilityRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IHeavyScheduleAvailabilityRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IHeavyScheduleAvailabilityRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new HeavyScheduleAvailabilityRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal HeavyScheduleAvailabilityRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __scheduleAvailabilityRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityRequest(json); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __scheduleAvailabilityRequest?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.PowerShell.cs new file mode 100644 index 00000000000..c99fd4318fe --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Managed identity properties. + [System.ComponentModel.TypeConverter(typeof(IdentityPropertiesTypeConverter))] + public partial class IdentityProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new IdentityProperties(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.DataBox.Models.IIdentityProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new IdentityProperties(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.DataBox.Models.IIdentityProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal IdentityProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("UserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)this).UserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("UserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)this).UserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)this).UserAssignedResourceId, 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 IdentityProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("UserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)this).UserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("UserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)this).UserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)this).UserAssignedResourceId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Managed identity properties. + [System.ComponentModel.TypeConverter(typeof(IdentityPropertiesTypeConverter))] + public partial interface IIdentityProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.TypeConverter.cs new file mode 100644 index 00000000000..b1569744427 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IdentityPropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return IdentityProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return IdentityProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return IdentityProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.cs new file mode 100644 index 00000000000..32aa9d16736 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Managed identity properties. + public partial class IdentityProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal + { + + /// Internal Acessors for UserAssigned + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal.UserAssigned { get => (this._userAssigned = this._userAssigned ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedProperties()); set { {_userAssigned = value;} } } + + /// Backing field for property. + private string _type; + + /// Managed service identity type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties _userAssigned; + + /// User assigned identity properties. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties UserAssigned { get => (this._userAssigned = this._userAssigned ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedProperties()); set => this._userAssigned = value; } + + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string UserAssignedResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedPropertiesInternal)UserAssigned).ResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedPropertiesInternal)UserAssigned).ResourceId = value ?? null; } + + /// Creates an new instance. + public IdentityProperties() + { + + } + } + /// Managed identity properties. + public partial interface IIdentityProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Managed service identity type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Managed service identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Arm resource id for user assigned identity to be used to fetch MSI token.", + SerializedName = @"resourceId", + PossibleTypes = new [] { typeof(string) })] + string UserAssignedResourceId { get; set; } + + } + /// Managed identity properties. + internal partial interface IIdentityPropertiesInternal + + { + /// Managed service identity type. + string Type { get; set; } + /// User assigned identity properties. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties UserAssigned { get; set; } + /// Arm resource id for user assigned identity to be used to fetch MSI token. + string UserAssignedResourceId { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.json.cs new file mode 100644 index 00000000000..31a2a8f6112 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/IdentityProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Managed identity properties. + public partial class IdentityProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new IdentityProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal IdentityProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_userAssigned = If( json?.PropertyT("userAssigned"), out var __jsonUserAssigned) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedProperties.FromJson(__jsonUserAssigned) : _userAssigned;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._userAssigned ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._userAssigned.ToJson(null,serializationMode) : null, "userAssigned" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.PowerShell.cs new file mode 100644 index 00000000000..fcb2c956fd4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Import disk details + [System.ComponentModel.TypeConverter(typeof(ImportDiskDetailsTypeConverter))] + public partial class ImportDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImportDiskDetails(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.DataBox.Models.IImportDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImportDiskDetails(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.DataBox.Models.IImportDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImportDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ManifestFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).ManifestFile = (string) content.GetValueForProperty("ManifestFile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).ManifestFile, global::System.Convert.ToString); + } + if (content.Contains("ManifestHash")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).ManifestHash = (string) content.GetValueForProperty("ManifestHash",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).ManifestHash, global::System.Convert.ToString); + } + if (content.Contains("BitLockerKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).BitLockerKey = (System.Security.SecureString) content.GetValueForProperty("BitLockerKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).BitLockerKey, (object ss) => (System.Security.SecureString)ss); + } + if (content.Contains("BackupManifestCloudPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).BackupManifestCloudPath = (string) content.GetValueForProperty("BackupManifestCloudPath",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).BackupManifestCloudPath, 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 ImportDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ManifestFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).ManifestFile = (string) content.GetValueForProperty("ManifestFile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).ManifestFile, global::System.Convert.ToString); + } + if (content.Contains("ManifestHash")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).ManifestHash = (string) content.GetValueForProperty("ManifestHash",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).ManifestHash, global::System.Convert.ToString); + } + if (content.Contains("BitLockerKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).BitLockerKey = (System.Security.SecureString) content.GetValueForProperty("BitLockerKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).BitLockerKey, (object ss) => (System.Security.SecureString)ss); + } + if (content.Contains("BackupManifestCloudPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).BackupManifestCloudPath = (string) content.GetValueForProperty("BackupManifestCloudPath",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal)this).BackupManifestCloudPath, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Import disk details + [System.ComponentModel.TypeConverter(typeof(ImportDiskDetailsTypeConverter))] + public partial interface IImportDiskDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.TypeConverter.cs new file mode 100644 index 00000000000..1755a65f169 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImportDiskDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImportDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImportDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImportDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.cs new file mode 100644 index 00000000000..797568aee3d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Import disk details + public partial class ImportDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal + { + + /// Backing field for property. + private string _backupManifestCloudPath; + + /// Path to backed up manifest, only returned if enableManifestBackup is true. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string BackupManifestCloudPath { get => this._backupManifestCloudPath; } + + /// Backing field for property. + private System.Security.SecureString _bitLockerKey; + + /// BitLocker key used to encrypt the disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Security.SecureString BitLockerKey { get => this._bitLockerKey; set => this._bitLockerKey = value; } + + /// Backing field for property. + private string _manifestFile; + + /// The relative path of the manifest file on the disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ManifestFile { get => this._manifestFile; set => this._manifestFile = value; } + + /// Backing field for property. + private string _manifestHash; + + /// The Base16-encoded MD5 hash of the manifest file on the disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ManifestHash { get => this._manifestHash; set => this._manifestHash = value; } + + /// Internal Acessors for BackupManifestCloudPath + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetailsInternal.BackupManifestCloudPath { get => this._backupManifestCloudPath; set { {_backupManifestCloudPath = value;} } } + + /// Creates an new instance. + public ImportDiskDetails() + { + + } + } + /// Import disk details + public partial interface IImportDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Path to backed up manifest, only returned if enableManifestBackup is true. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Path to backed up manifest, only returned if enableManifestBackup is true.", + SerializedName = @"backupManifestCloudPath", + PossibleTypes = new [] { typeof(string) })] + string BackupManifestCloudPath { get; } + /// BitLocker key used to encrypt the disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"BitLocker key used to encrypt the disk.", + SerializedName = @"bitLockerKey", + PossibleTypes = new [] { typeof(System.Security.SecureString) })] + System.Security.SecureString BitLockerKey { get; set; } + /// The relative path of the manifest file on the disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The relative path of the manifest file on the disk.", + SerializedName = @"manifestFile", + PossibleTypes = new [] { typeof(string) })] + string ManifestFile { get; set; } + /// The Base16-encoded MD5 hash of the manifest file on the disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The Base16-encoded MD5 hash of the manifest file on the disk.", + SerializedName = @"manifestHash", + PossibleTypes = new [] { typeof(string) })] + string ManifestHash { get; set; } + + } + /// Import disk details + internal partial interface IImportDiskDetailsInternal + + { + /// Path to backed up manifest, only returned if enableManifestBackup is true. + string BackupManifestCloudPath { get; set; } + /// BitLocker key used to encrypt the disk. + System.Security.SecureString BitLockerKey { get; set; } + /// The relative path of the manifest file on the disk. + string ManifestFile { get; set; } + /// The Base16-encoded MD5 hash of the manifest file on the disk. + string ManifestHash { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.json.cs new file mode 100644 index 00000000000..ecf948d8dae --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ImportDiskDetails.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Import disk details + public partial class ImportDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IImportDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ImportDiskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ImportDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_manifestFile = If( json?.PropertyT("manifestFile"), out var __jsonManifestFile) ? (string)__jsonManifestFile : (string)_manifestFile;} + {_manifestHash = If( json?.PropertyT("manifestHash"), out var __jsonManifestHash) ? (string)__jsonManifestHash : (string)_manifestHash;} + {_bitLockerKey = If( json?.PropertyT("bitLockerKey"), out var __jsonBitLockerKey) ? new System.Net.NetworkCredential("",(string)__jsonBitLockerKey).SecurePassword : _bitLockerKey;} + {_backupManifestCloudPath = If( json?.PropertyT("backupManifestCloudPath"), out var __jsonBackupManifestCloudPath) ? (string)__jsonBackupManifestCloudPath : (string)_backupManifestCloudPath;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._manifestFile)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._manifestFile.ToString()) : null, "manifestFile" ,container.Add ); + AddIf( null != (((object)this._manifestHash)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._manifestHash.ToString()) : null, "manifestHash" ,container.Add ); + AddIf( null != (((object)this._bitLockerKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(System.Runtime.InteropServices.Marshal.PtrToStringBSTR(System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this._bitLockerKey))) : null, "bitLockerKey" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._backupManifestCloudPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._backupManifestCloudPath.ToString()) : null, "backupManifestCloudPath" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.PowerShell.cs new file mode 100644 index 00000000000..881ff2e9c23 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.PowerShell.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Job Delay Notification details + [System.ComponentModel.TypeConverter(typeof(JobDelayDetailsTypeConverter))] + public partial class JobDelayDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobDelayDetails(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.DataBox.Models.IJobDelayDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobDelayDetails(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.DataBox.Models.IJobDelayDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobDelayDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ResolutionTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).ResolutionTime = (global::System.DateTime?) content.GetValueForProperty("ResolutionTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).ResolutionTime, (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 . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobDelayDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ResolutionTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).ResolutionTime = (global::System.DateTime?) content.GetValueForProperty("ResolutionTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal)this).ResolutionTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Job Delay Notification details + [System.ComponentModel.TypeConverter(typeof(JobDelayDetailsTypeConverter))] + public partial interface IJobDelayDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.TypeConverter.cs new file mode 100644 index 00000000000..85146c6723b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobDelayDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobDelayDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobDelayDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobDelayDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.cs new file mode 100644 index 00000000000..4e550bc370b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job Delay Notification details + public partial class JobDelayDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal + { + + /// Backing field for property. + private string _description; + + /// Description of the delay. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Description { get => this._description; } + + /// Backing field for property. + private string _errorCode; + + /// Delay Error code + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal.Description { get => this._description; set { {_description = value;} } } + + /// Internal Acessors for ErrorCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal.ErrorCode { get => this._errorCode; set { {_errorCode = value;} } } + + /// Internal Acessors for ResolutionTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal.ResolutionTime { get => this._resolutionTime; set { {_resolutionTime = value;} } } + + /// Internal Acessors for StartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal.StartTime { get => this._startTime; set { {_startTime = value;} } } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetailsInternal.Status { get => this._status; set { {_status = value;} } } + + /// Backing field for property. + private global::System.DateTime? _resolutionTime; + + /// Timestamp when the delay notification was resolved. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public global::System.DateTime? ResolutionTime { get => this._resolutionTime; } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// Timestamp when the delay notification was created. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; } + + /// Backing field for property. + private string _status; + + /// Status of notification + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Status { get => this._status; } + + /// Creates an new instance. + public JobDelayDetails() + { + + } + } + /// Job Delay Notification details + public partial interface IJobDelayDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Description of the delay. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Description of the delay.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; } + /// Delay Error code + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Delay Error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("InternalIssueDelay", "ActiveOrderLimitBreachedDelay", "HighDemandDelay", "LargeNumberOfFilesDelay")] + string ErrorCode { get; } + /// Timestamp when the delay notification was resolved. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Timestamp when the delay notification was resolved.", + SerializedName = @"resolutionTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ResolutionTime { get; } + /// Timestamp when the delay notification was created. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Timestamp when the delay notification was created.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; } + /// Status of notification + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Status of notification", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Active", "Resolved")] + string Status { get; } + + } + /// Job Delay Notification details + internal partial interface IJobDelayDetailsInternal + + { + /// Description of the delay. + string Description { get; set; } + /// Delay Error code + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("InternalIssueDelay", "ActiveOrderLimitBreachedDelay", "HighDemandDelay", "LargeNumberOfFilesDelay")] + string ErrorCode { get; set; } + /// Timestamp when the delay notification was resolved. + global::System.DateTime? ResolutionTime { get; set; } + /// Timestamp when the delay notification was created. + global::System.DateTime? StartTime { get; set; } + /// Status of notification + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Active", "Resolved")] + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.json.cs new file mode 100644 index 00000000000..6b041452627 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDelayDetails.json.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job Delay Notification details + public partial class JobDelayDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new JobDelayDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal JobDelayDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)_errorCode;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)_description;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : _startTime : _startTime;} + {_resolutionTime = If( json?.PropertyT("resolutionTime"), out var __jsonResolutionTime) ? global::System.DateTime.TryParse((string)__jsonResolutionTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonResolutionTimeValue) ? __jsonResolutionTimeValue : _resolutionTime : _resolutionTime;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._startTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "startTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._resolutionTime ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._resolutionTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "resolutionTime" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.PowerShell.cs new file mode 100644 index 00000000000..761571855dd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Additional delivery info. + [System.ComponentModel.TypeConverter(typeof(JobDeliveryInfoTypeConverter))] + public partial class JobDeliveryInfo + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobDeliveryInfo(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.DataBox.Models.IJobDeliveryInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobDeliveryInfo(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.DataBox.Models.IJobDeliveryInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobDeliveryInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ScheduledDateTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfoInternal)this).ScheduledDateTime = (global::System.DateTime?) content.GetValueForProperty("ScheduledDateTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfoInternal)this).ScheduledDateTime, (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 . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobDeliveryInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ScheduledDateTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfoInternal)this).ScheduledDateTime = (global::System.DateTime?) content.GetValueForProperty("ScheduledDateTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfoInternal)this).ScheduledDateTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Additional delivery info. + [System.ComponentModel.TypeConverter(typeof(JobDeliveryInfoTypeConverter))] + public partial interface IJobDeliveryInfo + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.TypeConverter.cs new file mode 100644 index 00000000000..562ac42231e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobDeliveryInfoTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobDeliveryInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobDeliveryInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobDeliveryInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.cs new file mode 100644 index 00000000000..0f8ea65d32b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Additional delivery info. + public partial class JobDeliveryInfo : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfoInternal + { + + /// Backing field for property. + private global::System.DateTime? _scheduledDateTime; + + /// Scheduled date time. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public global::System.DateTime? ScheduledDateTime { get => this._scheduledDateTime; set => this._scheduledDateTime = value; } + + /// Creates an new instance. + public JobDeliveryInfo() + { + + } + } + /// Additional delivery info. + public partial interface IJobDeliveryInfo : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Scheduled date time. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Scheduled date time.", + SerializedName = @"scheduledDateTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ScheduledDateTime { get; set; } + + } + /// Additional delivery info. + internal partial interface IJobDeliveryInfoInternal + + { + /// Scheduled date time. + global::System.DateTime? ScheduledDateTime { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.json.cs new file mode 100644 index 00000000000..15450e4a2e9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDeliveryInfo.json.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Additional delivery info. + public partial class JobDeliveryInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new JobDeliveryInfo(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal JobDeliveryInfo(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_scheduledDateTime = If( json?.PropertyT("scheduledDateTime"), out var __jsonScheduledDateTime) ? global::System.DateTime.TryParse((string)__jsonScheduledDateTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonScheduledDateTimeValue) ? __jsonScheduledDateTimeValue : _scheduledDateTime : _scheduledDateTime;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._scheduledDateTime ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._scheduledDateTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "scheduledDateTime" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.PowerShell.cs new file mode 100644 index 00000000000..97e5a9c2775 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.PowerShell.cs @@ -0,0 +1,874 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Job details. + [System.ComponentModel.TypeConverter(typeof(JobDetailsTypeConverter))] + public partial class JobDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobDetails(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.DataBox.Models.IJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobDetails(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.DataBox.Models.IJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails) content.GetValueForProperty("ReverseShippingDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceErasureDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails) content.GetValueForProperty("DeviceErasureDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey) content.GetValueForProperty("KeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKeyTypeConverter.ConvertFrom); + } + if (content.Contains("LastMitigationActionOnJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob) content.GetValueForProperty("LastMitigationActionOnJob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJobTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse) content.GetValueForProperty("DatacenterAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponseTypeConverter.ConvertFrom); + } + if (content.Contains("JobStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage = (System.Collections.Generic.List) content.GetValueForProperty("JobStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobStagesTypeConverter.ConvertFrom)); + } + if (content.Contains("DataImportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataImportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DataExportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataExportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CopyLogDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail = (System.Collections.Generic.List) content.GetValueForProperty("CopyLogDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReverseShipmentLabelSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey = (string) content.GetValueForProperty("ReverseShipmentLabelSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey, global::System.Convert.ToString); + } + if (content.Contains("ChainOfCustodySasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey = (string) content.GetValueForProperty("ChainOfCustodySasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey, global::System.Convert.ToString); + } + if (content.Contains("ExpectedDataSizeInTeraByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte = (int?) content.GetValueForProperty("ExpectedDataSizeInTeraByte",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode = (string) content.GetValueForProperty("DataCenterCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailEmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailEmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContactDetailNotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailNotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ReverseShippingDetailShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyIdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("KeyEncryptionKeyIdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyKekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType = (string) content.GetValueForProperty("KeyEncryptionKeyKekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName = (string) content.GetValueForProperty("ContactDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone = (string) content.GetValueForProperty("ContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension = (string) content.GetValueForProperty("ContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile = (string) content.GetValueForProperty("ContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl = (string) content.GetValueForProperty("DeliveryPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId = (string) content.GetValueForProperty("DeliveryPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl = (string) content.GetValueForProperty("ReturnPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId = (string) content.GetValueForProperty("ReturnPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ReverseShippingDetailContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated = (bool?) content.GetValueForProperty("ReverseShippingDetailIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailDeviceErasureStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus = (string) content.GetValueForProperty("DeviceErasureDetailDeviceErasureStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailErasureOrDestructionCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailErasureOrDestructionCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailSecureErasureCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailSecureErasureCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl = (string) content.GetValueForProperty("KeyEncryptionKeyKekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId = (string) content.GetValueForProperty("KeyEncryptionKeyKekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("LastMitigationActionOnJobActionDateTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastMitigationActionOnJobActionDateTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMitigationActionOnJobIsPerformedByCustomer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer = (bool?) content.GetValueForProperty("LastMitigationActionOnJobIsPerformedByCustomer",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastMitigationActionOnJobCustomerResolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution = (string) content.GetValueForProperty("LastMitigationActionOnJobCustomerResolution",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressSupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("DatacenterAddressSupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DatacenterAddressDataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation = (string) content.GetValueForProperty("DatacenterAddressDataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName = (string) content.GetValueForProperty("ReverseShippingDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ReverseShippingDetailsShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId, 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 JobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnPackage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails) content.GetValueForProperty("ReverseShippingDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceErasureDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails) content.GetValueForProperty("DeviceErasureDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey) content.GetValueForProperty("KeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKeyTypeConverter.ConvertFrom); + } + if (content.Contains("LastMitigationActionOnJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob) content.GetValueForProperty("LastMitigationActionOnJob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJob, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJobTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse) content.GetValueForProperty("DatacenterAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponseTypeConverter.ConvertFrom); + } + if (content.Contains("JobStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage = (System.Collections.Generic.List) content.GetValueForProperty("JobStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).JobStage, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobStagesTypeConverter.ConvertFrom)); + } + if (content.Contains("DataImportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataImportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataImportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DataExportDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail = (System.Collections.Generic.List) content.GetValueForProperty("DataExportDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataExportDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CopyLogDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail = (System.Collections.Generic.List) content.GetValueForProperty("CopyLogDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CopyLogDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReverseShipmentLabelSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey = (string) content.GetValueForProperty("ReverseShipmentLabelSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShipmentLabelSasKey, global::System.Convert.ToString); + } + if (content.Contains("ChainOfCustodySasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey = (string) content.GetValueForProperty("ChainOfCustodySasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ChainOfCustodySasKey, global::System.Convert.ToString); + } + if (content.Contains("ExpectedDataSizeInTeraByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte = (int?) content.GetValueForProperty("ExpectedDataSizeInTeraByte",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ExpectedDataSizeInTeraByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Action")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action = (System.Collections.Generic.List) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Action, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DataCenterCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode = (string) content.GetValueForProperty("DataCenterCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DataCenterCode, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailEmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailEmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailEmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContactDetailNotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailNotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailNotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ReverseShippingDetailShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyIdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("KeyEncryptionKeyIdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyKekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType = (string) content.GetValueForProperty("KeyEncryptionKeyKekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName = (string) content.GetValueForProperty("ContactDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone = (string) content.GetValueForProperty("ContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension = (string) content.GetValueForProperty("ContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile = (string) content.GetValueForProperty("ContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl = (string) content.GetValueForProperty("DeliveryPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliveryPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId = (string) content.GetValueForProperty("DeliveryPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeliveryPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl = (string) content.GetValueForProperty("ReturnPackageTrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnPackageTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId = (string) content.GetValueForProperty("ReturnPackageTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReturnPackageTrackingId, global::System.Convert.ToString); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ReverseShippingDetailContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated = (bool?) content.GetValueForProperty("ReverseShippingDetailIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailDeviceErasureStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus = (string) content.GetValueForProperty("DeviceErasureDetailDeviceErasureStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailDeviceErasureStatus, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailErasureOrDestructionCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailErasureOrDestructionCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailErasureOrDestructionCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("DeviceErasureDetailSecureErasureCertificateSasKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey = (string) content.GetValueForProperty("DeviceErasureDetailSecureErasureCertificateSasKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DeviceErasureDetailSecureErasureCertificateSasKey, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl = (string) content.GetValueForProperty("KeyEncryptionKeyKekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekUrl, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId = (string) content.GetValueForProperty("KeyEncryptionKeyKekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("LastMitigationActionOnJobActionDateTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastMitigationActionOnJobActionDateTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobActionDateTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMitigationActionOnJobIsPerformedByCustomer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer = (bool?) content.GetValueForProperty("LastMitigationActionOnJobIsPerformedByCustomer",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobIsPerformedByCustomer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastMitigationActionOnJobCustomerResolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution = (string) content.GetValueForProperty("LastMitigationActionOnJobCustomerResolution",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).LastMitigationActionOnJobCustomerResolution, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressSupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("DatacenterAddressSupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressSupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DatacenterAddressDataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation = (string) content.GetValueForProperty("DatacenterAddressDataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).DatacenterAddressDataCenterAzureLocation, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName = (string) content.GetValueForProperty("ReverseShippingDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ReverseShippingDetailsShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal)this).UserAssignedResourceId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Job details. + [System.ComponentModel.TypeConverter(typeof(JobDetailsTypeConverter))] + public partial interface IJobDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.TypeConverter.cs new file mode 100644 index 00000000000..63e23a39491 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.cs new file mode 100644 index 00000000000..5961adcfd77 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.cs @@ -0,0 +1,1596 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job details. + public partial class JobDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _action; + + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List Action { get => this._action; } + + /// Backing field for property. + private string _chainOfCustodySasKey; + + /// Shared access key to download the chain of custody logs + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ChainOfCustodySasKey { get => this._chainOfCustodySasKey; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string City { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).City = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string CompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).CompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).CompanyName = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails _contactDetail; + + /// Contact details for notification and shipping. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails ContactDetail { get => (this._contactDetail = this._contactDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetails()); set => this._contactDetail = value; } + + /// List of Email-ids to be notified about job progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List ContactDetailEmailList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).EmailList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).EmailList = value ; } + + /// Notification preference for a job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List ContactDetailNotificationPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).NotificationPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).NotificationPreference = value ?? null /* arrayOf */; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ContactDetailsContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).ContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).ContactName = value ; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ContactDetailsMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).Mobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).Mobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ContactDetailsPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).Phone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).Phone = value ; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ContactDetailsPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).PhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).PhoneExtension = value ?? null; } + + /// Backing field for property. + private System.Collections.Generic.List _copyLogDetail; + + /// List of copy log details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List CopyLogDetail { get => this._copyLogDetail; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Country { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).Country = value ?? null; } + + /// Backing field for property. + private string _dataCenterCode; + + /// DataCenter code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DataCenterCode { get => this._dataCenterCode; } + + /// Backing field for property. + private System.Collections.Generic.List _dataExportDetail; + + /// Details of the data to be exported from azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List DataExportDetail { get => this._dataExportDetail; set => this._dataExportDetail = value; } + + /// Backing field for property. + private System.Collections.Generic.List _dataImportDetail; + + /// Details of the data to be imported into azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List DataImportDetail { get => this._dataImportDetail; set => this._dataImportDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse _datacenterAddress; + + /// Datacenter address to ship to, for the given sku and storage location. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse DatacenterAddress { get => (this._datacenterAddress = this._datacenterAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponse()); } + + /// Azure Location where the Data Center serves primarily. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DatacenterAddressDataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddress).DataCenterAzureLocation; } + + /// List of supported carriers for return shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List DatacenterAddressSupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddress).SupportedCarriersForReturnShipment; } + + /// Data center address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DatacenterAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddress).DatacenterAddressType; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails _deliveryPackage; + + /// Delivery package shipping details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails DeliveryPackage { get => (this._deliveryPackage = this._deliveryPackage ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetails()); } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)DeliveryPackage).CarrierName; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeliveryPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)DeliveryPackage).TrackingId; } + + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeliveryPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)DeliveryPackage).TrackingUrl; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails _deviceErasureDetail; + + /// Holds device data erasure details + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails DeviceErasureDetail { get => (this._deviceErasureDetail = this._deviceErasureDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetails()); } + + /// Holds the device erasure completion status + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeviceErasureDetailDeviceErasureStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)DeviceErasureDetail).DeviceErasureStatus; } + + /// Shared access key to download cleanup or destruction certificate for device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeviceErasureDetailErasureOrDestructionCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)DeviceErasureDetail).ErasureOrDestructionCertificateSasKey; } + + /// Shared access key to download secure erasure certificate for the device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeviceErasureDetailSecureErasureCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)DeviceErasureDetail).SecureErasureCertificateSasKey; } + + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string EncryptionPreferenceDoubleEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreferenceDoubleEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreferenceDoubleEncryption = value ?? null; } + + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string EncryptionPreferenceHardwareEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreferenceHardwareEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreferenceHardwareEncryption = value ?? null; } + + /// Backing field for property. + private int? _expectedDataSizeInTeraByte; + + /// + /// The expected size of the data, which needs to be transferred in this job, in terabytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public int? ExpectedDataSizeInTeraByte { get => this._expectedDataSizeInTeraByte; set => this._expectedDataSizeInTeraByte = value; } + + /// Managed service identity type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string IdentityPropertyType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).IdentityPropertyType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).IdentityPropertyType = value ?? null; } + + /// Backing field for property. + private System.Collections.Generic.List _jobStage; + + /// List of stages that run in the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List JobStage { get => this._jobStage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey _keyEncryptionKey; + + /// Details about which key encryption type is being used. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey KeyEncryptionKey { get => (this._keyEncryptionKey = this._keyEncryptionKey ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKey()); set => this._keyEncryptionKey = value; } + + /// Type of encryption key used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyKekType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).KekType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).KekType = value ?? null; } + + /// Key encryption key. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyKekUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).KekUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).KekUrl = value ?? null; } + + /// Kek vault resource id. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyKekVaultResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).KekVaultResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).KekVaultResourceId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob _lastMitigationActionOnJob; + + /// Last mitigation action performed on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob LastMitigationActionOnJob { get => (this._lastMitigationActionOnJob = this._lastMitigationActionOnJob ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJob()); } + + /// Action performed date time + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public global::System.DateTime? LastMitigationActionOnJobActionDateTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)LastMitigationActionOnJob).ActionDateTimeInUtc; } + + /// Resolution code provided by customer + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string LastMitigationActionOnJobCustomerResolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)LastMitigationActionOnJob).CustomerResolution; } + + /// + /// Action performed by customer, + /// possibility is that mitigation might happen by customer or service or by ops + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? LastMitigationActionOnJobIsPerformedByCustomer { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)LastMitigationActionOnJob).IsPerformedByCustomer; } + + /// Internal Acessors for Action + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.Action { get => this._action; set { {_action = value;} } } + + /// Internal Acessors for ChainOfCustodySasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ChainOfCustodySasKey { get => this._chainOfCustodySasKey; set { {_chainOfCustodySasKey = value;} } } + + /// Internal Acessors for ContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ContactDetail { get => (this._contactDetail = this._contactDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetails()); set { {_contactDetail = value;} } } + + /// Internal Acessors for CopyLogDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.CopyLogDetail { get => this._copyLogDetail; set { {_copyLogDetail = value;} } } + + /// Internal Acessors for DataCenterCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DataCenterCode { get => this._dataCenterCode; set { {_dataCenterCode = value;} } } + + /// Internal Acessors for DatacenterAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddress { get => (this._datacenterAddress = this._datacenterAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponse()); set { {_datacenterAddress = value;} } } + + /// Internal Acessors for DatacenterAddressDataCenterAzureLocation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressDataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddress).DataCenterAzureLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddress).DataCenterAzureLocation = value ?? null; } + + /// Internal Acessors for DatacenterAddressSupportedCarriersForReturnShipment + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressSupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddress).SupportedCarriersForReturnShipment; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddress).SupportedCarriersForReturnShipment = value ?? null /* arrayOf */; } + + /// Internal Acessors for DatacenterAddressType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DatacenterAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddress).DatacenterAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddress).DatacenterAddressType = value ?? null; } + + /// Internal Acessors for DeliveryPackage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackage { get => (this._deliveryPackage = this._deliveryPackage ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetails()); set { {_deliveryPackage = value;} } } + + /// Internal Acessors for DeliveryPackageCarrierName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)DeliveryPackage).CarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)DeliveryPackage).CarrierName = value ?? null; } + + /// Internal Acessors for DeliveryPackageTrackingId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)DeliveryPackage).TrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)DeliveryPackage).TrackingId = value ?? null; } + + /// Internal Acessors for DeliveryPackageTrackingUrl + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeliveryPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)DeliveryPackage).TrackingUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)DeliveryPackage).TrackingUrl = value ?? null; } + + /// Internal Acessors for DeviceErasureDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetail { get => (this._deviceErasureDetail = this._deviceErasureDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetails()); set { {_deviceErasureDetail = value;} } } + + /// Internal Acessors for DeviceErasureDetailDeviceErasureStatus + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailDeviceErasureStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)DeviceErasureDetail).DeviceErasureStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)DeviceErasureDetail).DeviceErasureStatus = value ?? null; } + + /// Internal Acessors for DeviceErasureDetailErasureOrDestructionCertificateSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailErasureOrDestructionCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)DeviceErasureDetail).ErasureOrDestructionCertificateSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)DeviceErasureDetail).ErasureOrDestructionCertificateSasKey = value ?? null; } + + /// Internal Acessors for DeviceErasureDetailSecureErasureCertificateSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.DeviceErasureDetailSecureErasureCertificateSasKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)DeviceErasureDetail).SecureErasureCertificateSasKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetailsInternal)DeviceErasureDetail).SecureErasureCertificateSasKey = value ?? null; } + + /// Internal Acessors for IdentityPropertyUserAssigned + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.IdentityPropertyUserAssigned { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).IdentityPropertyUserAssigned; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).IdentityPropertyUserAssigned = value ?? null /* model class */; } + + /// Internal Acessors for JobStage + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.JobStage { get => this._jobStage; set { {_jobStage = value;} } } + + /// Internal Acessors for KeyEncryptionKey + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.KeyEncryptionKey { get => (this._keyEncryptionKey = this._keyEncryptionKey ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKey()); set { {_keyEncryptionKey = value;} } } + + /// Internal Acessors for KeyEncryptionKeyIdentityProperty + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.KeyEncryptionKeyIdentityProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).IdentityProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).IdentityProperty = value ?? null /* model class */; } + + /// Internal Acessors for LastMitigationActionOnJob + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJob { get => (this._lastMitigationActionOnJob = this._lastMitigationActionOnJob ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJob()); set { {_lastMitigationActionOnJob = value;} } } + + /// Internal Acessors for LastMitigationActionOnJobActionDateTimeInUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobActionDateTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)LastMitigationActionOnJob).ActionDateTimeInUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)LastMitigationActionOnJob).ActionDateTimeInUtc = value ?? default(global::System.DateTime); } + + /// Internal Acessors for LastMitigationActionOnJobCustomerResolution + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobCustomerResolution { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)LastMitigationActionOnJob).CustomerResolution; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)LastMitigationActionOnJob).CustomerResolution = value ?? null; } + + /// Internal Acessors for LastMitigationActionOnJobIsPerformedByCustomer + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.LastMitigationActionOnJobIsPerformedByCustomer { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)LastMitigationActionOnJob).IsPerformedByCustomer; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)LastMitigationActionOnJob).IsPerformedByCustomer = value ?? default(bool); } + + /// Internal Acessors for Preference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.Preference { get => (this._preference = this._preference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Preferences()); set { {_preference = value;} } } + + /// Internal Acessors for PreferenceEncryptionPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceEncryptionPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceReverseTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceReverseTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.PreferenceTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for ReturnPackage + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackage { get => (this._returnPackage = this._returnPackage ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetails()); set { {_returnPackage = value;} } } + + /// Internal Acessors for ReturnPackageCarrierName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)ReturnPackage).CarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)ReturnPackage).CarrierName = value ?? null; } + + /// Internal Acessors for ReturnPackageTrackingId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)ReturnPackage).TrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)ReturnPackage).TrackingId = value ?? null; } + + /// Internal Acessors for ReturnPackageTrackingUrl + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReturnPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)ReturnPackage).TrackingUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)ReturnPackage).TrackingUrl = value ?? null; } + + /// Internal Acessors for ReverseShipmentLabelSasKey + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShipmentLabelSasKey { get => this._reverseShipmentLabelSasKey; set { {_reverseShipmentLabelSasKey = value;} } } + + /// Internal Acessors for ReverseShippingDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetail { get => (this._reverseShippingDetail = this._reverseShippingDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetails()); set { {_reverseShippingDetail = value;} } } + + /// Internal Acessors for ReverseShippingDetailContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetail = value ?? null /* model class */; } + + /// Internal Acessors for ReverseShippingDetailIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).IsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).IsUpdated = value ?? default(bool); } + + /// Internal Acessors for ReverseShippingDetailShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseShippingDetailShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddress = value ?? null /* model class */; } + + /// Internal Acessors for ReverseTransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferenceIsUpdated = value ?? default(bool); } + + /// Internal Acessors for ShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.ShippingAddress { get => (this._shippingAddress = this._shippingAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress()); set { {_shippingAddress = value;} } } + + /// Internal Acessors for TransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetailsInternal.TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferenceIsUpdated = value ?? default(bool); } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string PostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).PostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).PostalCode = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences _preference; + + /// Preferences for the order. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Preference { get => (this._preference = this._preference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Preferences()); set => this._preference = value; } + + /// Preferred data center region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List PreferencePreferredDataCenterRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).PreferredDataCenterRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).PreferredDataCenterRegion = value ?? null /* arrayOf */; } + + /// Preferences related to the Access Tier of storage accounts. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).StorageAccountAccessTierPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).StorageAccountAccessTierPreference = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails _returnPackage; + + /// Return package shipping details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails ReturnPackage { get => (this._returnPackage = this._returnPackage ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetails()); } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)ReturnPackage).CarrierName; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReturnPackageTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)ReturnPackage).TrackingId; } + + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReturnPackageTrackingUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)ReturnPackage).TrackingUrl; } + + /// Backing field for property. + private string _reverseShipmentLabelSasKey; + + /// Shared access key to download the return shipment label + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ReverseShipmentLabelSasKey { get => this._reverseShipmentLabelSasKey; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails _reverseShippingDetail; + + /// Optional Reverse Shipping details for order. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails ReverseShippingDetail { get => (this._reverseShippingDetail = this._reverseShippingDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetails()); set => this._reverseShippingDetail = value; } + + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? ReverseShippingDetailIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).IsUpdated; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsContactDetailsMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailMobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailMobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsContactDetailsPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailPhone = value ?? null; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsContactDetailsPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailPhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailPhoneExtension = value ?? null; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailContactName = value ?? null; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressCity = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressCompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressCompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressCompanyName = value ?? null; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressCountry { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressCountry; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressCountry = value ?? null; } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressPostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressPostalCode = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? ReverseShippingDetailsShippingAddressSkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressSkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressSkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressStreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressTaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressTaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressTaxIdentificationNumber = value ?? null; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressType = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressZipExtendedCode = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseTransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferencePreferredShipmentType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress _shippingAddress; + + /// Shipping address of the customer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ShippingAddress { get => (this._shippingAddress = this._shippingAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress()); set => this._shippingAddress = value; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).AddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).AddressType = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? SkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).SkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).SkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string StateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string StreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string StreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string StreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).TaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).TaxIdentificationNumber = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferencePreferredShipmentType = value ?? null; } + + /// Backing field for property. + private string _type; + + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string UserAssignedResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).UserAssignedResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).UserAssignedResourceId = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).ZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).ZipExtendedCode = value ?? null; } + + /// Creates an new instance. + public JobDetails() + { + + } + } + /// Job details. + public partial interface IJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Available actions on the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Available actions on the job.", + SerializedName = @"actions", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + System.Collections.Generic.List Action { get; } + /// Shared access key to download the chain of custody logs + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Shared access key to download the chain of custody logs", + SerializedName = @"chainOfCustodySasKey", + PossibleTypes = new [] { typeof(string) })] + string ChainOfCustodySasKey { get; } + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the City.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string City { get; set; } + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the company.", + SerializedName = @"companyName", + PossibleTypes = new [] { typeof(string) })] + string CompanyName { get; set; } + /// List of Email-ids to be notified about job progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of Email-ids to be notified about job progress.", + SerializedName = @"emailList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List ContactDetailEmailList { get; set; } + /// Notification preference for a job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Notification preference for a job stage.", + SerializedName = @"notificationPreference", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreference) })] + System.Collections.Generic.List ContactDetailNotificationPreference { get; set; } + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Contact name of the person.", + SerializedName = @"contactName", + PossibleTypes = new [] { typeof(string) })] + string ContactDetailsContactName { get; set; } + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Mobile number of the contact person.", + SerializedName = @"mobile", + PossibleTypes = new [] { typeof(string) })] + string ContactDetailsMobile { get; set; } + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone number of the contact person.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ContactDetailsPhone { get; set; } + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone extension number of the contact person.", + SerializedName = @"phoneExtension", + PossibleTypes = new [] { typeof(string) })] + string ContactDetailsPhoneExtension { get; set; } + /// List of copy log details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of copy log details.", + SerializedName = @"copyLogDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails) })] + System.Collections.Generic.List CopyLogDetail { get; } + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the Country.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string Country { get; set; } + /// DataCenter code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"DataCenter code.", + SerializedName = @"dataCenterCode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Invalid", "BY2", "BY1", "ORK70", "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", "BJS20", "BL24", "IDC5", "TYO23", "NTG20", "DXB23", "DSM11", "AMS25", "CPQ21", "OSA23")] + string DataCenterCode { get; } + /// Details of the data to be exported from azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details of the data to be exported from azure.", + SerializedName = @"dataExportDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetails) })] + System.Collections.Generic.List DataExportDetail { get; set; } + /// Details of the data to be imported into azure. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details of the data to be imported into azure.", + SerializedName = @"dataImportDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataImportDetails) })] + System.Collections.Generic.List DataImportDetail { get; set; } + /// Azure Location where the Data Center serves primarily. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Azure Location where the Data Center serves primarily.", + SerializedName = @"dataCenterAzureLocation", + PossibleTypes = new [] { typeof(string) })] + string DatacenterAddressDataCenterAzureLocation { get; } + /// List of supported carriers for return shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of supported carriers for return shipment.", + SerializedName = @"supportedCarriersForReturnShipment", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List DatacenterAddressSupportedCarriersForReturnShipment { get; } + /// Data center address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Data center address type", + SerializedName = @"datacenterAddressType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DatacenterAddressLocation", "DatacenterAddressInstruction")] + string DatacenterAddressType { get; } + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the carrier.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageCarrierName { get; } + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Tracking Id of shipment.", + SerializedName = @"trackingId", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageTrackingId { get; } + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Url where shipment can be tracked.", + SerializedName = @"trackingUrl", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageTrackingUrl { get; } + /// Holds the device erasure completion status + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Holds the device erasure completion status", + SerializedName = @"deviceErasureStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "InProgress", "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", "CustomerActionPerformed")] + string DeviceErasureDetailDeviceErasureStatus { get; } + /// Shared access key to download cleanup or destruction certificate for device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Shared access key to download cleanup or destruction certificate for device", + SerializedName = @"erasureOrDestructionCertificateSasKey", + PossibleTypes = new [] { typeof(string) })] + string DeviceErasureDetailErasureOrDestructionCertificateSasKey { get; } + /// Shared access key to download secure erasure certificate for the device + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Shared access key to download secure erasure certificate for the device", + SerializedName = @"secureErasureCertificateSasKey", + PossibleTypes = new [] { typeof(string) })] + string DeviceErasureDetailSecureErasureCertificateSasKey { get; } + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Defines secondary layer of software-based encryption enablement.", + SerializedName = @"doubleEncryption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceDoubleEncryption { get; set; } + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Defines Hardware level encryption (Only for disk)", + SerializedName = @"hardwareEncryption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceHardwareEncryption { get; set; } + /// + /// The expected size of the data, which needs to be transferred in this job, in terabytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The expected size of the data, which needs to be transferred in this job, in terabytes.", + SerializedName = @"expectedDataSizeInTeraBytes", + PossibleTypes = new [] { typeof(int) })] + int? ExpectedDataSizeInTeraByte { get; set; } + /// Managed service identity type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Managed service identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string IdentityPropertyType { get; set; } + /// List of stages that run in the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of stages that run in the job.", + SerializedName = @"jobStages", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStages) })] + System.Collections.Generic.List JobStage { get; } + /// Type of encryption key used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of encryption key used for key encryption.", + SerializedName = @"kekType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("MicrosoftManaged", "CustomerManaged")] + string KeyEncryptionKeyKekType { get; set; } + /// Key encryption key. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Key encryption key. It is required in case of Customer managed KekType.", + SerializedName = @"kekUrl", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyKekUrl { get; set; } + /// Kek vault resource id. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Kek vault resource id. It is required in case of Customer managed KekType.", + SerializedName = @"kekVaultResourceID", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyKekVaultResourceId { get; set; } + /// Action performed date time + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Action performed date time", + SerializedName = @"actionDateTimeInUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastMitigationActionOnJobActionDateTimeInUtc { get; } + /// Resolution code provided by customer + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Resolution code provided by customer", + SerializedName = @"customerResolution", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + string LastMitigationActionOnJobCustomerResolution { get; } + /// + /// Action performed by customer, + /// possibility is that mitigation might happen by customer or service or by ops + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Action performed by customer, + possibility is that mitigation might happen by customer or service or by ops", + SerializedName = @"isPerformedByCustomer", + PossibleTypes = new [] { typeof(bool) })] + bool? LastMitigationActionOnJobIsPerformedByCustomer { get; } + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Postal code.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string PostalCode { get; set; } + /// Preferred data center region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Preferred data center region.", + SerializedName = @"preferredDataCenterRegion", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List PreferencePreferredDataCenterRegion { get; set; } + /// Preferences related to the Access Tier of storage accounts. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Preferences related to the Access Tier of storage accounts.", + SerializedName = @"storageAccountAccessTierPreferences", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Archive")] + System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get; set; } + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the carrier.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string ReturnPackageCarrierName { get; } + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Tracking Id of shipment.", + SerializedName = @"trackingId", + PossibleTypes = new [] { typeof(string) })] + string ReturnPackageTrackingId { get; } + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Url where shipment can be tracked.", + SerializedName = @"trackingUrl", + PossibleTypes = new [] { typeof(string) })] + string ReturnPackageTrackingUrl { get; } + /// Shared access key to download the return shipment label + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Shared access key to download the return shipment label", + SerializedName = @"reverseShipmentLabelSasKey", + PossibleTypes = new [] { typeof(string) })] + string ReverseShipmentLabelSasKey { get; } + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + Read only field", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? ReverseShippingDetailIsUpdated { get; } + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Mobile number of the contact person.", + SerializedName = @"mobile", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsContactDetailsMobile { get; set; } + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone number of the contact person.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsContactDetailsPhone { get; set; } + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone extension number of the contact person.", + SerializedName = @"phoneExtension", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsContactDetailsPhoneExtension { get; set; } + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Contact name of the person.", + SerializedName = @"contactName", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsContactName { get; set; } + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the City.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressCity { get; set; } + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the company.", + SerializedName = @"companyName", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressCompanyName { get; set; } + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the Country.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressCountry { get; set; } + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Postal code.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressPostalCode { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Flag to indicate if customer has chosen to skip default address validation", + SerializedName = @"skipAddressValidation", + PossibleTypes = new [] { typeof(bool) })] + bool? ReverseShippingDetailsShippingAddressSkipAddressValidation { get; set; } + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the State or Province.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressStateOrProvince { get; set; } + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 1.", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressStreetAddress1 { get; set; } + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 2.", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressStreetAddress2 { get; set; } + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 3.", + SerializedName = @"streetAddress3", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressStreetAddress3 { get; set; } + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Tax Identification Number", + SerializedName = @"taxIdentificationNumber", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressTaxIdentificationNumber { get; set; } + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of address.", + SerializedName = @"addressType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string ReverseShippingDetailsShippingAddressType { get; set; } + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Extended Zip Code.", + SerializedName = @"zipExtendedCode", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressZipExtendedCode { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? ReverseTransportPreferenceIsUpdated { get; } + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates Shipment Logistics type that the customer preferred.", + SerializedName = @"preferredShipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string ReverseTransportPreferencePreferredShipmentType { get; set; } + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of address.", + SerializedName = @"addressType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string ShippingAddressType { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Flag to indicate if customer has chosen to skip default address validation", + SerializedName = @"skipAddressValidation", + PossibleTypes = new [] { typeof(bool) })] + bool? SkipAddressValidation { get; set; } + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the State or Province.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string StateOrProvince { get; set; } + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 1.", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress1 { get; set; } + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 2.", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress2 { get; set; } + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 3.", + SerializedName = @"streetAddress3", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress3 { get; set; } + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Tax Identification Number", + SerializedName = @"taxIdentificationNumber", + PossibleTypes = new [] { typeof(string) })] + string TaxIdentificationNumber { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? TransportPreferenceIsUpdated { get; } + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates Shipment Logistics type that the customer preferred.", + SerializedName = @"preferredShipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string TransportPreferencePreferredShipmentType { get; set; } + /// Indicates the type of job details. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates the type of job details.", + SerializedName = @"jobDetailsType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string Type { get; set; } + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Arm resource id for user assigned identity to be used to fetch MSI token.", + SerializedName = @"resourceId", + PossibleTypes = new [] { typeof(string) })] + string UserAssignedResourceId { get; set; } + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Extended Zip Code.", + SerializedName = @"zipExtendedCode", + PossibleTypes = new [] { typeof(string) })] + string ZipExtendedCode { get; set; } + + } + /// Job details. + internal partial interface IJobDetailsInternal + + { + /// Available actions on the job. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + System.Collections.Generic.List Action { get; set; } + /// Shared access key to download the chain of custody logs + string ChainOfCustodySasKey { get; set; } + /// Name of the City. + string City { get; set; } + /// Name of the company. + string CompanyName { get; set; } + /// Contact details for notification and shipping. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails ContactDetail { get; set; } + /// List of Email-ids to be notified about job progress. + System.Collections.Generic.List ContactDetailEmailList { get; set; } + /// Notification preference for a job stage. + System.Collections.Generic.List ContactDetailNotificationPreference { get; set; } + /// Contact name of the person. + string ContactDetailsContactName { get; set; } + /// Mobile number of the contact person. + string ContactDetailsMobile { get; set; } + /// Phone number of the contact person. + string ContactDetailsPhone { get; set; } + /// Phone extension number of the contact person. + string ContactDetailsPhoneExtension { get; set; } + /// List of copy log details. + System.Collections.Generic.List CopyLogDetail { get; set; } + /// Name of the Country. + string Country { get; set; } + /// DataCenter code. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Invalid", "BY2", "BY1", "ORK70", "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", "BJS20", "BL24", "IDC5", "TYO23", "NTG20", "DXB23", "DSM11", "AMS25", "CPQ21", "OSA23")] + string DataCenterCode { get; set; } + /// Details of the data to be exported from azure. + System.Collections.Generic.List DataExportDetail { get; set; } + /// Details of the data to be imported into azure. + System.Collections.Generic.List DataImportDetail { get; set; } + /// Datacenter address to ship to, for the given sku and storage location. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse DatacenterAddress { get; set; } + /// Azure Location where the Data Center serves primarily. + string DatacenterAddressDataCenterAzureLocation { get; set; } + /// List of supported carriers for return shipment. + System.Collections.Generic.List DatacenterAddressSupportedCarriersForReturnShipment { get; set; } + /// Data center address type + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DatacenterAddressLocation", "DatacenterAddressInstruction")] + string DatacenterAddressType { get; set; } + /// Delivery package shipping details. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails DeliveryPackage { get; set; } + /// Name of the carrier. + string DeliveryPackageCarrierName { get; set; } + /// Tracking Id of shipment. + string DeliveryPackageTrackingId { get; set; } + /// Url where shipment can be tracked. + string DeliveryPackageTrackingUrl { get; set; } + /// Holds device data erasure details + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceErasureDetails DeviceErasureDetail { get; set; } + /// Holds the device erasure completion status + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "InProgress", "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", "CustomerActionPerformed")] + string DeviceErasureDetailDeviceErasureStatus { get; set; } + /// Shared access key to download cleanup or destruction certificate for device + string DeviceErasureDetailErasureOrDestructionCertificateSasKey { get; set; } + /// Shared access key to download secure erasure certificate for the device + string DeviceErasureDetailSecureErasureCertificateSasKey { get; set; } + /// Defines secondary layer of software-based encryption enablement. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceDoubleEncryption { get; set; } + /// Defines Hardware level encryption (Only for disk) + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceHardwareEncryption { get; set; } + /// + /// The expected size of the data, which needs to be transferred in this job, in terabytes. + /// + int? ExpectedDataSizeInTeraByte { get; set; } + /// Managed service identity type. + string IdentityPropertyType { get; set; } + /// User assigned identity properties. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties IdentityPropertyUserAssigned { get; set; } + /// List of stages that run in the job. + System.Collections.Generic.List JobStage { get; set; } + /// Details about which key encryption type is being used. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey KeyEncryptionKey { get; set; } + /// Managed identity properties used for key encryption. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties KeyEncryptionKeyIdentityProperty { get; set; } + /// Type of encryption key used for key encryption. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("MicrosoftManaged", "CustomerManaged")] + string KeyEncryptionKeyKekType { get; set; } + /// Key encryption key. It is required in case of Customer managed KekType. + string KeyEncryptionKeyKekUrl { get; set; } + /// Kek vault resource id. It is required in case of Customer managed KekType. + string KeyEncryptionKeyKekVaultResourceId { get; set; } + /// Last mitigation action performed on the job. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob LastMitigationActionOnJob { get; set; } + /// Action performed date time + global::System.DateTime? LastMitigationActionOnJobActionDateTimeInUtc { get; set; } + /// Resolution code provided by customer + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + string LastMitigationActionOnJobCustomerResolution { get; set; } + /// + /// Action performed by customer, + /// possibility is that mitigation might happen by customer or service or by ops + /// + bool? LastMitigationActionOnJobIsPerformedByCustomer { get; set; } + /// Postal code. + string PostalCode { get; set; } + /// Preferences for the order. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Preference { get; set; } + /// Preferences related to the Encryption. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences PreferenceEncryptionPreference { get; set; } + /// Preferred data center region. + System.Collections.Generic.List PreferencePreferredDataCenterRegion { get; set; } + /// Optional Preferences related to the reverse shipment logistics of the sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceReverseTransportPreference { get; set; } + /// Preferences related to the Access Tier of storage accounts. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Archive")] + System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get; set; } + /// Preferences related to the shipment logistics of the sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceTransportPreference { get; set; } + /// Return package shipping details. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails ReturnPackage { get; set; } + /// Name of the carrier. + string ReturnPackageCarrierName { get; set; } + /// Tracking Id of shipment. + string ReturnPackageTrackingId { get; set; } + /// Url where shipment can be tracked. + string ReturnPackageTrackingUrl { get; set; } + /// Shared access key to download the return shipment label + string ReverseShipmentLabelSasKey { get; set; } + /// Optional Reverse Shipping details for order. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails ReverseShippingDetail { get; set; } + /// Contact Info. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo ReverseShippingDetailContactDetail { get; set; } + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + bool? ReverseShippingDetailIsUpdated { get; set; } + /// Shipping address where customer wishes to receive the device. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ReverseShippingDetailShippingAddress { get; set; } + /// Mobile number of the contact person. + string ReverseShippingDetailsContactDetailsMobile { get; set; } + /// Phone number of the contact person. + string ReverseShippingDetailsContactDetailsPhone { get; set; } + /// Phone extension number of the contact person. + string ReverseShippingDetailsContactDetailsPhoneExtension { get; set; } + /// Contact name of the person. + string ReverseShippingDetailsContactName { get; set; } + /// Name of the City. + string ReverseShippingDetailsShippingAddressCity { get; set; } + /// Name of the company. + string ReverseShippingDetailsShippingAddressCompanyName { get; set; } + /// Name of the Country. + string ReverseShippingDetailsShippingAddressCountry { get; set; } + /// Postal code. + string ReverseShippingDetailsShippingAddressPostalCode { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + bool? ReverseShippingDetailsShippingAddressSkipAddressValidation { get; set; } + /// Name of the State or Province. + string ReverseShippingDetailsShippingAddressStateOrProvince { get; set; } + /// Street Address line 1. + string ReverseShippingDetailsShippingAddressStreetAddress1 { get; set; } + /// Street Address line 2. + string ReverseShippingDetailsShippingAddressStreetAddress2 { get; set; } + /// Street Address line 3. + string ReverseShippingDetailsShippingAddressStreetAddress3 { get; set; } + /// Tax Identification Number + string ReverseShippingDetailsShippingAddressTaxIdentificationNumber { get; set; } + /// Type of address. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string ReverseShippingDetailsShippingAddressType { get; set; } + /// Extended Zip Code. + string ReverseShippingDetailsShippingAddressZipExtendedCode { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + bool? ReverseTransportPreferenceIsUpdated { get; set; } + /// Indicates Shipment Logistics type that the customer preferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string ReverseTransportPreferencePreferredShipmentType { get; set; } + /// Shipping address of the customer. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ShippingAddress { get; set; } + /// Type of address. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string ShippingAddressType { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + bool? SkipAddressValidation { get; set; } + /// Name of the State or Province. + string StateOrProvince { get; set; } + /// Street Address line 1. + string StreetAddress1 { get; set; } + /// Street Address line 2. + string StreetAddress2 { get; set; } + /// Street Address line 3. + string StreetAddress3 { get; set; } + /// Tax Identification Number + string TaxIdentificationNumber { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + bool? TransportPreferenceIsUpdated { get; set; } + /// Indicates Shipment Logistics type that the customer preferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string TransportPreferencePreferredShipmentType { get; set; } + /// Indicates the type of job details. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string Type { get; set; } + /// Arm resource id for user assigned identity to be used to fetch MSI token. + string UserAssignedResourceId { get; set; } + /// Extended Zip Code. + string ZipExtendedCode { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.json.cs new file mode 100644 index 00000000000..8a6fbfb1429 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobDetails.json.cs @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job details. + public partial class JobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails interface is polymorphic, and the precise model + /// class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("jobDetailsType") ) + { + case "DataBoxCustomerDisk": + { + return new DataBoxCustomerDiskJobDetails(json); + } + case "DataBoxDisk": + { + return new DataBoxDiskJobDetails(json); + } + case "DataBoxHeavy": + { + return new DataBoxHeavyJobDetails(json); + } + case "DataBox": + { + return new DataBoxJobDetails(json); + } + } + return new JobDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal JobDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_contactDetail = If( json?.PropertyT("contactDetails"), out var __jsonContactDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetails.FromJson(__jsonContactDetails) : _contactDetail;} + {_shippingAddress = If( json?.PropertyT("shippingAddress"), out var __jsonShippingAddress) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress.FromJson(__jsonShippingAddress) : _shippingAddress;} + {_deliveryPackage = If( json?.PropertyT("deliveryPackage"), out var __jsonDeliveryPackage) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetails.FromJson(__jsonDeliveryPackage) : _deliveryPackage;} + {_returnPackage = If( json?.PropertyT("returnPackage"), out var __jsonReturnPackage) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageShippingDetails.FromJson(__jsonReturnPackage) : _returnPackage;} + {_preference = If( json?.PropertyT("preferences"), out var __jsonPreferences) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Preferences.FromJson(__jsonPreferences) : _preference;} + {_reverseShippingDetail = If( json?.PropertyT("reverseShippingDetails"), out var __jsonReverseShippingDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetails.FromJson(__jsonReverseShippingDetails) : _reverseShippingDetail;} + {_deviceErasureDetail = If( json?.PropertyT("deviceErasureDetails"), out var __jsonDeviceErasureDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceErasureDetails.FromJson(__jsonDeviceErasureDetails) : _deviceErasureDetail;} + {_keyEncryptionKey = If( json?.PropertyT("keyEncryptionKey"), out var __jsonKeyEncryptionKey) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKey.FromJson(__jsonKeyEncryptionKey) : _keyEncryptionKey;} + {_lastMitigationActionOnJob = If( json?.PropertyT("lastMitigationActionOnJob"), out var __jsonLastMitigationActionOnJob) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.LastMitigationActionOnJob.FromJson(__jsonLastMitigationActionOnJob) : _lastMitigationActionOnJob;} + {_datacenterAddress = If( json?.PropertyT("datacenterAddress"), out var __jsonDatacenterAddress) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponse.FromJson(__jsonDatacenterAddress) : _datacenterAddress;} + {_jobStage = If( json?.PropertyT("jobStages"), out var __jsonJobStages) ? If( __jsonJobStages as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IJobStages) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobStages.FromJson(__u) )) ))() : null : _jobStage;} + {_dataImportDetail = If( json?.PropertyT("dataImportDetails"), out var __jsonDataImportDetails) ? If( __jsonDataImportDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDataImportDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataImportDetails.FromJson(__p) )) ))() : null : _dataImportDetail;} + {_dataExportDetail = If( json?.PropertyT("dataExportDetails"), out var __jsonDataExportDetails) ? If( __jsonDataExportDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __l) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataExportDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataExportDetails.FromJson(__k) )) ))() : null : _dataExportDetail;} + {_type = If( json?.PropertyT("jobDetailsType"), out var __jsonJobDetailsType) ? (string)__jsonJobDetailsType : (string)_type;} + {_copyLogDetail = If( json?.PropertyT("copyLogDetails"), out var __jsonCopyLogDetails) ? If( __jsonCopyLogDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __g) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__g, (__f)=>(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICopyLogDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CopyLogDetails.FromJson(__f) )) ))() : null : _copyLogDetail;} + {_reverseShipmentLabelSasKey = If( json?.PropertyT("reverseShipmentLabelSasKey"), out var __jsonReverseShipmentLabelSasKey) ? (string)__jsonReverseShipmentLabelSasKey : (string)_reverseShipmentLabelSasKey;} + {_chainOfCustodySasKey = If( json?.PropertyT("chainOfCustodySasKey"), out var __jsonChainOfCustodySasKey) ? (string)__jsonChainOfCustodySasKey : (string)_chainOfCustodySasKey;} + {_expectedDataSizeInTeraByte = If( json?.PropertyT("expectedDataSizeInTeraBytes"), out var __jsonExpectedDataSizeInTeraBytes) ? (int?)__jsonExpectedDataSizeInTeraBytes : _expectedDataSizeInTeraByte;} + {_action = If( json?.PropertyT("actions"), out var __jsonActions) ? If( __jsonActions as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __b) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__b, (__a)=>(string) (__a is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString ___z ? (string)(___z.ToString()) : null)) ))() : null : _action;} + {_dataCenterCode = If( json?.PropertyT("dataCenterCode"), out var __jsonDataCenterCode) ? (string)__jsonDataCenterCode : (string)_dataCenterCode;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._contactDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._contactDetail.ToJson(null,serializationMode) : null, "contactDetails" ,container.Add ); + AddIf( null != this._shippingAddress ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._shippingAddress.ToJson(null,serializationMode) : null, "shippingAddress" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._deliveryPackage ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._deliveryPackage.ToJson(null,serializationMode) : null, "deliveryPackage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._returnPackage ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._returnPackage.ToJson(null,serializationMode) : null, "returnPackage" ,container.Add ); + } + AddIf( null != this._preference ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._preference.ToJson(null,serializationMode) : null, "preferences" ,container.Add ); + AddIf( null != this._reverseShippingDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._reverseShippingDetail.ToJson(null,serializationMode) : null, "reverseShippingDetails" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._deviceErasureDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._deviceErasureDetail.ToJson(null,serializationMode) : null, "deviceErasureDetails" ,container.Add ); + } + AddIf( null != this._keyEncryptionKey ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._keyEncryptionKey.ToJson(null,serializationMode) : null, "keyEncryptionKey" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._lastMitigationActionOnJob ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._lastMitigationActionOnJob.ToJson(null,serializationMode) : null, "lastMitigationActionOnJob" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._datacenterAddress ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._datacenterAddress.ToJson(null,serializationMode) : null, "datacenterAddress" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._jobStage) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._jobStage ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("jobStages",__w); + } + } + if (null != this._dataImportDetail) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __s in this._dataImportDetail ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("dataImportDetails",__r); + } + if (null != this._dataExportDetail) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __n in this._dataExportDetail ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("dataExportDetails",__m); + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._type.ToString()) : null, "jobDetailsType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._copyLogDetail) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __i in this._copyLogDetail ) + { + AddIf(__i?.ToJson(null, serializationMode) ,__h.Add); + } + container.Add("copyLogDetails",__h); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._reverseShipmentLabelSasKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._reverseShipmentLabelSasKey.ToString()) : null, "reverseShipmentLabelSasKey" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._chainOfCustodySasKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._chainOfCustodySasKey.ToString()) : null, "chainOfCustodySasKey" ,container.Add ); + } + AddIf( null != this._expectedDataSizeInTeraByte ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((int)this._expectedDataSizeInTeraByte) : null, "expectedDataSizeInTeraBytes" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._action) + { + var __c = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __d in this._action ) + { + AddIf(null != (((object)__d)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__d.ToString()) : null ,__c.Add); + } + container.Add("actions",__c); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._dataCenterCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._dataCenterCode.ToString()) : null, "dataCenterCode" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.PowerShell.cs new file mode 100644 index 00000000000..a67e8fc85cb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.PowerShell.cs @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Job Properties + [System.ComponentModel.TypeConverter(typeof(JobPropertiesTypeConverter))] + public partial class JobProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobProperties(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.DataBox.Models.IJobProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobProperties(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.DataBox.Models.IJobProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DeliveryInfo = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo) content.GetValueForProperty("DeliveryInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DeliveryInfo, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDeliveryInfoTypeConverter.ConvertFrom); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("IsCancellable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsCancellable = (bool?) content.GetValueForProperty("IsCancellable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsCancellable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IsDeletable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsDeletable = (bool?) content.GetValueForProperty("IsDeletable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsDeletable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IsShippingAddressEditable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsShippingAddressEditable = (bool?) content.GetValueForProperty("IsShippingAddressEditable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsShippingAddressEditable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).ReverseShippingDetailsUpdate = (string) content.GetValueForProperty("ReverseShippingDetailsUpdate",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).ReverseShippingDetailsUpdate, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).ReverseTransportPreferenceUpdate = (string) content.GetValueForProperty("ReverseTransportPreferenceUpdate",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).ReverseTransportPreferenceUpdate, global::System.Convert.ToString); + } + if (content.Contains("IsPrepareToShipEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsPrepareToShipEnabled = (bool?) content.GetValueForProperty("IsPrepareToShipEnabled",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsPrepareToShipEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("DelayedStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DelayedStage = (string) content.GetValueForProperty("DelayedStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DelayedStage, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CancellationReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).CancellationReason = (string) content.GetValueForProperty("CancellationReason",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).CancellationReason, global::System.Convert.ToString); + } + if (content.Contains("DeliveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DeliveryType = (string) content.GetValueForProperty("DeliveryType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DeliveryType, global::System.Convert.ToString); + } + if (content.Contains("IsCancellableWithoutFee")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsCancellableWithoutFee = (bool?) content.GetValueForProperty("IsCancellableWithoutFee",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsCancellableWithoutFee, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AllDevicesLost")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).AllDevicesLost = (bool?) content.GetValueForProperty("AllDevicesLost",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).AllDevicesLost, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Detail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("ErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).ErrorDetail = (System.Collections.Generic.List) content.GetValueForProperty("ErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).ErrorDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("DeliveryInfoScheduledDateTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DeliveryInfoScheduledDateTime = (global::System.DateTime?) content.GetValueForProperty("DeliveryInfoScheduledDateTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DeliveryInfoScheduledDateTime, (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 . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DeliveryInfo = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo) content.GetValueForProperty("DeliveryInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DeliveryInfo, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDeliveryInfoTypeConverter.ConvertFrom); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("IsCancellable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsCancellable = (bool?) content.GetValueForProperty("IsCancellable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsCancellable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IsDeletable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsDeletable = (bool?) content.GetValueForProperty("IsDeletable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsDeletable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IsShippingAddressEditable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsShippingAddressEditable = (bool?) content.GetValueForProperty("IsShippingAddressEditable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsShippingAddressEditable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).ReverseShippingDetailsUpdate = (string) content.GetValueForProperty("ReverseShippingDetailsUpdate",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).ReverseShippingDetailsUpdate, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).ReverseTransportPreferenceUpdate = (string) content.GetValueForProperty("ReverseTransportPreferenceUpdate",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).ReverseTransportPreferenceUpdate, global::System.Convert.ToString); + } + if (content.Contains("IsPrepareToShipEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsPrepareToShipEnabled = (bool?) content.GetValueForProperty("IsPrepareToShipEnabled",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsPrepareToShipEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("DelayedStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DelayedStage = (string) content.GetValueForProperty("DelayedStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DelayedStage, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CancellationReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).CancellationReason = (string) content.GetValueForProperty("CancellationReason",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).CancellationReason, global::System.Convert.ToString); + } + if (content.Contains("DeliveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DeliveryType = (string) content.GetValueForProperty("DeliveryType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DeliveryType, global::System.Convert.ToString); + } + if (content.Contains("IsCancellableWithoutFee")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsCancellableWithoutFee = (bool?) content.GetValueForProperty("IsCancellableWithoutFee",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).IsCancellableWithoutFee, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AllDevicesLost")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).AllDevicesLost = (bool?) content.GetValueForProperty("AllDevicesLost",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).AllDevicesLost, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Detail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("ErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).ErrorDetail = (System.Collections.Generic.List) content.GetValueForProperty("ErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).ErrorDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("DeliveryInfoScheduledDateTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DeliveryInfoScheduledDateTime = (global::System.DateTime?) content.GetValueForProperty("DeliveryInfoScheduledDateTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)this).DeliveryInfoScheduledDateTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Job Properties + [System.ComponentModel.TypeConverter(typeof(JobPropertiesTypeConverter))] + public partial interface IJobProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.TypeConverter.cs new file mode 100644 index 00000000000..e0a72240a30 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobPropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.cs new file mode 100644 index 00000000000..e5fe21bd062 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job Properties + public partial class JobProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal + { + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo; } + + /// Backing field for property. + private bool? _allDevicesLost; + + /// Flag to indicate if all devices associated with the job are lost. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? AllDevicesLost { get => this._allDevicesLost; } + + /// Backing field for property. + private string _cancellationReason; + + /// Reason for cancellation. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CancellationReason { get => this._cancellationReason; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code; } + + /// Backing field for property. + private string _delayedStage; + + /// Name of the stage where delay might be present. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DelayedStage { get => this._delayedStage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo _deliveryInfo; + + /// Delivery Info of Job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo DeliveryInfo { get => (this._deliveryInfo = this._deliveryInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDeliveryInfo()); set => this._deliveryInfo = value; } + + /// Scheduled date time. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public global::System.DateTime? DeliveryInfoScheduledDateTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfoInternal)DeliveryInfo).ScheduledDateTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfoInternal)DeliveryInfo).ScheduledDateTime = value ?? default(global::System.DateTime); } + + /// Backing field for property. + private string _deliveryType; + + /// Delivery type of Job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DeliveryType { get => this._deliveryType; set => this._deliveryType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails _detail; + + /// Details of a job run. This field will only be sent for expand details filter. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails Detail { get => (this._detail = this._detail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetails()); set => this._detail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError _error; + + /// Top level error for the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError()); } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List ErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail; } + + /// Backing field for property. + private bool? _isCancellable; + + /// Describes whether the job is cancellable or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? IsCancellable { get => this._isCancellable; } + + /// Backing field for property. + private bool? _isCancellableWithoutFee; + + /// Flag to indicate cancellation of scheduled job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? IsCancellableWithoutFee { get => this._isCancellableWithoutFee; } + + /// Backing field for property. + private bool? _isDeletable; + + /// Describes whether the job is deletable or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? IsDeletable { get => this._isDeletable; } + + /// Backing field for property. + private bool? _isPrepareToShipEnabled; + + /// Is Prepare To Ship Enabled on this job + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? IsPrepareToShipEnabled { get => this._isPrepareToShipEnabled; } + + /// Backing field for property. + private bool? _isShippingAddressEditable; + + /// Describes whether the shipping address is editable or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? IsShippingAddressEditable { get => this._isShippingAddressEditable; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for AllDevicesLost + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.AllDevicesLost { get => this._allDevicesLost; set { {_allDevicesLost = value;} } } + + /// Internal Acessors for CancellationReason + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.CancellationReason { get => this._cancellationReason; set { {_cancellationReason = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code = value ?? null; } + + /// Internal Acessors for DelayedStage + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.DelayedStage { get => this._delayedStage; set { {_delayedStage = value;} } } + + /// Internal Acessors for DeliveryInfo + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.DeliveryInfo { get => (this._deliveryInfo = this._deliveryInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDeliveryInfo()); set { {_deliveryInfo = value;} } } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError()); set { {_error = value;} } } + + /// Internal Acessors for ErrorDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.ErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for IsCancellable + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.IsCancellable { get => this._isCancellable; set { {_isCancellable = value;} } } + + /// Internal Acessors for IsCancellableWithoutFee + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.IsCancellableWithoutFee { get => this._isCancellableWithoutFee; set { {_isCancellableWithoutFee = value;} } } + + /// Internal Acessors for IsDeletable + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.IsDeletable { get => this._isDeletable; set { {_isDeletable = value;} } } + + /// Internal Acessors for IsPrepareToShipEnabled + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.IsPrepareToShipEnabled { get => this._isPrepareToShipEnabled; set { {_isPrepareToShipEnabled = value;} } } + + /// Internal Acessors for IsShippingAddressEditable + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.IsShippingAddressEditable { get => this._isShippingAddressEditable; set { {_isShippingAddressEditable = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message = value ?? null; } + + /// Internal Acessors for ReverseShippingDetailsUpdate + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.ReverseShippingDetailsUpdate { get => this._reverseShippingDetailsUpdate; set { {_reverseShippingDetailsUpdate = value;} } } + + /// Internal Acessors for ReverseTransportPreferenceUpdate + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.ReverseTransportPreferenceUpdate { get => this._reverseTransportPreferenceUpdate; set { {_reverseTransportPreferenceUpdate = value;} } } + + /// Internal Acessors for StartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.StartTime { get => this._startTime; set { {_startTime = value;} } } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.Status { get => this._status; set { {_status = value;} } } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target = value ?? null; } + + /// Backing field for property. + private string _reverseShippingDetailsUpdate; + + /// The Editable status for Reverse Shipping Address and Contact Info + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ReverseShippingDetailsUpdate { get => this._reverseShippingDetailsUpdate; } + + /// Backing field for property. + private string _reverseTransportPreferenceUpdate; + + /// The Editable status for Reverse Transport preferences + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ReverseTransportPreferenceUpdate { get => this._reverseTransportPreferenceUpdate; } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// Time at which the job was started in UTC ISO 8601 format. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; } + + /// Backing field for property. + private string _status; + + /// Name of the stage which is in progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Status { get => this._status; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target; } + + /// Backing field for property. + private string _transferType; + + /// Type of the data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string TransferType { get => this._transferType; set => this._transferType = value; } + + /// Creates an new instance. + public JobProperties() + { + + } + } + /// Job Properties + public partial interface IJobProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets additional error info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// Flag to indicate if all devices associated with the job are lost. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Flag to indicate if all devices associated with the job are lost.", + SerializedName = @"allDevicesLost", + PossibleTypes = new [] { typeof(bool) })] + bool? AllDevicesLost { get; } + /// Reason for cancellation. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Reason for cancellation.", + SerializedName = @"cancellationReason", + PossibleTypes = new [] { typeof(string) })] + string CancellationReason { get; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// Name of the stage where delay might be present. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the stage where delay might be present.", + SerializedName = @"delayedStage", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", "ShippedToCustomer")] + string DelayedStage { get; } + /// Scheduled date time. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Scheduled date time.", + SerializedName = @"scheduledDateTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DeliveryInfoScheduledDateTime { get; set; } + /// Delivery type of Job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Delivery type of Job.", + SerializedName = @"deliveryType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("NonScheduled", "Scheduled")] + string DeliveryType { get; set; } + /// Details of a job run. This field will only be sent for expand details filter. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details of a job run. This field will only be sent for expand details filter.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails Detail { get; set; } + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets details for the error.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) })] + System.Collections.Generic.List ErrorDetail { get; } + /// Describes whether the job is cancellable or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Describes whether the job is cancellable or not.", + SerializedName = @"isCancellable", + PossibleTypes = new [] { typeof(bool) })] + bool? IsCancellable { get; } + /// Flag to indicate cancellation of scheduled job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Flag to indicate cancellation of scheduled job.", + SerializedName = @"isCancellableWithoutFee", + PossibleTypes = new [] { typeof(bool) })] + bool? IsCancellableWithoutFee { get; } + /// Describes whether the job is deletable or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Describes whether the job is deletable or not.", + SerializedName = @"isDeletable", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDeletable { get; } + /// Is Prepare To Ship Enabled on this job + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Is Prepare To Ship Enabled on this job", + SerializedName = @"isPrepareToShipEnabled", + PossibleTypes = new [] { typeof(bool) })] + bool? IsPrepareToShipEnabled { get; } + /// Describes whether the shipping address is editable or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Describes whether the shipping address is editable or not.", + SerializedName = @"isShippingAddressEditable", + PossibleTypes = new [] { typeof(bool) })] + bool? IsShippingAddressEditable { get; } + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message parsed from the body of the http error response.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The Editable status for Reverse Shipping Address and Contact Info + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The Editable status for Reverse Shipping Address and Contact Info", + SerializedName = @"reverseShippingDetailsUpdate", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled", "NotSupported")] + string ReverseShippingDetailsUpdate { get; } + /// The Editable status for Reverse Transport preferences + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The Editable status for Reverse Transport preferences", + SerializedName = @"reverseTransportPreferenceUpdate", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled", "NotSupported")] + string ReverseTransportPreferenceUpdate { get; } + /// Time at which the job was started in UTC ISO 8601 format. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Time at which the job was started in UTC ISO 8601 format.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; } + /// Name of the stage which is in progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the stage which is in progress.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", "ShippedToCustomer")] + string Status { get; } + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the target of the error.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + /// Type of the data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the data transfer.", + SerializedName = @"transferType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; set; } + + } + /// Job Properties + internal partial interface IJobPropertiesInternal + + { + /// Gets or sets additional error info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// Flag to indicate if all devices associated with the job are lost. + bool? AllDevicesLost { get; set; } + /// Reason for cancellation. + string CancellationReason { get; set; } + /// Error code. + string Code { get; set; } + /// Name of the stage where delay might be present. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", "ShippedToCustomer")] + string DelayedStage { get; set; } + /// Delivery Info of Job. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo DeliveryInfo { get; set; } + /// Scheduled date time. + global::System.DateTime? DeliveryInfoScheduledDateTime { get; set; } + /// Delivery type of Job. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("NonScheduled", "Scheduled")] + string DeliveryType { get; set; } + /// Details of a job run. This field will only be sent for expand details filter. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails Detail { get; set; } + /// Top level error for the job. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get; set; } + /// Gets or sets details for the error. + System.Collections.Generic.List ErrorDetail { get; set; } + /// Describes whether the job is cancellable or not. + bool? IsCancellable { get; set; } + /// Flag to indicate cancellation of scheduled job. + bool? IsCancellableWithoutFee { get; set; } + /// Describes whether the job is deletable or not. + bool? IsDeletable { get; set; } + /// Is Prepare To Ship Enabled on this job + bool? IsPrepareToShipEnabled { get; set; } + /// Describes whether the shipping address is editable or not. + bool? IsShippingAddressEditable { get; set; } + /// The error message parsed from the body of the http error response. + string Message { get; set; } + /// The Editable status for Reverse Shipping Address and Contact Info + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled", "NotSupported")] + string ReverseShippingDetailsUpdate { get; set; } + /// The Editable status for Reverse Transport preferences + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled", "NotSupported")] + string ReverseTransportPreferenceUpdate { get; set; } + /// Time at which the job was started in UTC ISO 8601 format. + global::System.DateTime? StartTime { get; set; } + /// Name of the stage which is in progress. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", "ShippedToCustomer")] + string Status { get; set; } + /// Gets or sets the target of the error. + string Target { get; set; } + /// Type of the data transfer. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.json.cs new file mode 100644 index 00000000000..015221ef72c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobProperties.json.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job Properties + public partial class JobProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new JobProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal JobProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError.FromJson(__jsonError) : _error;} + {_deliveryInfo = If( json?.PropertyT("deliveryInfo"), out var __jsonDeliveryInfo) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDeliveryInfo.FromJson(__jsonDeliveryInfo) : _deliveryInfo;} + {_transferType = If( json?.PropertyT("transferType"), out var __jsonTransferType) ? (string)__jsonTransferType : (string)_transferType;} + {_isCancellable = If( json?.PropertyT("isCancellable"), out var __jsonIsCancellable) ? (bool?)__jsonIsCancellable : _isCancellable;} + {_isDeletable = If( json?.PropertyT("isDeletable"), out var __jsonIsDeletable) ? (bool?)__jsonIsDeletable : _isDeletable;} + {_isShippingAddressEditable = If( json?.PropertyT("isShippingAddressEditable"), out var __jsonIsShippingAddressEditable) ? (bool?)__jsonIsShippingAddressEditable : _isShippingAddressEditable;} + {_reverseShippingDetailsUpdate = If( json?.PropertyT("reverseShippingDetailsUpdate"), out var __jsonReverseShippingDetailsUpdate) ? (string)__jsonReverseShippingDetailsUpdate : (string)_reverseShippingDetailsUpdate;} + {_reverseTransportPreferenceUpdate = If( json?.PropertyT("reverseTransportPreferenceUpdate"), out var __jsonReverseTransportPreferenceUpdate) ? (string)__jsonReverseTransportPreferenceUpdate : (string)_reverseTransportPreferenceUpdate;} + {_isPrepareToShipEnabled = If( json?.PropertyT("isPrepareToShipEnabled"), out var __jsonIsPrepareToShipEnabled) ? (bool?)__jsonIsPrepareToShipEnabled : _isPrepareToShipEnabled;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} + {_delayedStage = If( json?.PropertyT("delayedStage"), out var __jsonDelayedStage) ? (string)__jsonDelayedStage : (string)_delayedStage;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : _startTime : _startTime;} + {_cancellationReason = If( json?.PropertyT("cancellationReason"), out var __jsonCancellationReason) ? (string)__jsonCancellationReason : (string)_cancellationReason;} + {_deliveryType = If( json?.PropertyT("deliveryType"), out var __jsonDeliveryType) ? (string)__jsonDeliveryType : (string)_deliveryType;} + {_isCancellableWithoutFee = If( json?.PropertyT("isCancellableWithoutFee"), out var __jsonIsCancellableWithoutFee) ? (bool?)__jsonIsCancellableWithoutFee : _isCancellableWithoutFee;} + {_allDevicesLost = If( json?.PropertyT("allDevicesLost"), out var __jsonAllDevicesLost) ? (bool?)__jsonAllDevicesLost : _allDevicesLost;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetails.FromJson(__jsonDetails) : _detail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + } + AddIf( null != this._deliveryInfo ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._deliveryInfo.ToJson(null,serializationMode) : null, "deliveryInfo" ,container.Add ); + AddIf( null != (((object)this._transferType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._transferType.ToString()) : null, "transferType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._isCancellable ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._isCancellable) : null, "isCancellable" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._isDeletable ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._isDeletable) : null, "isDeletable" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._isShippingAddressEditable ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._isShippingAddressEditable) : null, "isShippingAddressEditable" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._reverseShippingDetailsUpdate)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._reverseShippingDetailsUpdate.ToString()) : null, "reverseShippingDetailsUpdate" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._reverseTransportPreferenceUpdate)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._reverseTransportPreferenceUpdate.ToString()) : null, "reverseTransportPreferenceUpdate" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._isPrepareToShipEnabled ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._isPrepareToShipEnabled) : null, "isPrepareToShipEnabled" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._delayedStage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._delayedStage.ToString()) : null, "delayedStage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._startTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "startTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._cancellationReason)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._cancellationReason.ToString()) : null, "cancellationReason" ,container.Add ); + } + AddIf( null != (((object)this._deliveryType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._deliveryType.ToString()) : null, "deliveryType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._isCancellableWithoutFee ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._isCancellableWithoutFee) : null, "isCancellableWithoutFee" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._allDevicesLost ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._allDevicesLost) : null, "allDevicesLost" ,container.Add ); + } + AddIf( null != this._detail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._detail.ToJson(null,serializationMode) : null, "details" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.PowerShell.cs new file mode 100644 index 00000000000..351ba9cf113 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.PowerShell.cs @@ -0,0 +1,522 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Job Resource. + [System.ComponentModel.TypeConverter(typeof(JobResourceTypeConverter))] + public partial class JobResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobResource(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.DataBox.Models.IJobResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobResource(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.DataBox.Models.IJobResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobResource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuTypeConverter.ConvertFrom); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DeliveryInfo = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo) content.GetValueForProperty("DeliveryInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DeliveryInfo, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDeliveryInfoTypeConverter.ConvertFrom); + } + if (content.Contains("IsCancellable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsCancellable = (bool?) content.GetValueForProperty("IsCancellable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsCancellable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IsDeletable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsDeletable = (bool?) content.GetValueForProperty("IsDeletable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsDeletable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IsShippingAddressEditable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsShippingAddressEditable = (bool?) content.GetValueForProperty("IsShippingAddressEditable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsShippingAddressEditable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).ReverseShippingDetailsUpdate = (string) content.GetValueForProperty("ReverseShippingDetailsUpdate",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).ReverseShippingDetailsUpdate, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).ReverseTransportPreferenceUpdate = (string) content.GetValueForProperty("ReverseTransportPreferenceUpdate",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).ReverseTransportPreferenceUpdate, global::System.Convert.ToString); + } + if (content.Contains("IsPrepareToShipEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsPrepareToShipEnabled = (bool?) content.GetValueForProperty("IsPrepareToShipEnabled",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsPrepareToShipEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("DelayedStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DelayedStage = (string) content.GetValueForProperty("DelayedStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DelayedStage, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CancellationReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).CancellationReason = (string) content.GetValueForProperty("CancellationReason",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).CancellationReason, global::System.Convert.ToString); + } + if (content.Contains("DeliveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DeliveryType = (string) content.GetValueForProperty("DeliveryType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DeliveryType, global::System.Convert.ToString); + } + if (content.Contains("IsCancellableWithoutFee")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsCancellableWithoutFee = (bool?) content.GetValueForProperty("IsCancellableWithoutFee",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsCancellableWithoutFee, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AllDevicesLost")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).AllDevicesLost = (bool?) content.GetValueForProperty("AllDevicesLost",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).AllDevicesLost, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Detail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("SkuDisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuDisplayName = (string) content.GetValueForProperty("SkuDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuDisplayName, global::System.Convert.ToString); + } + if (content.Contains("SkuFamily")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuFamily = (string) content.GetValueForProperty("SkuFamily",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuFamily, global::System.Convert.ToString); + } + if (content.Contains("SkuModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuModel = (string) content.GetValueForProperty("SkuModel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuModel, global::System.Convert.ToString); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityType = (string) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityType, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("IdentityUserAssignedIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityUserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities) content.GetValueForProperty("IdentityUserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityUserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("ErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).ErrorDetail = (System.Collections.Generic.List) content.GetValueForProperty("ErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).ErrorDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("DeliveryInfoScheduledDateTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DeliveryInfoScheduledDateTime = (global::System.DateTime?) content.GetValueForProperty("DeliveryInfoScheduledDateTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DeliveryInfoScheduledDateTime, (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 . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobResource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuTypeConverter.ConvertFrom); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("DeliveryInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DeliveryInfo = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo) content.GetValueForProperty("DeliveryInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DeliveryInfo, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDeliveryInfoTypeConverter.ConvertFrom); + } + if (content.Contains("IsCancellable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsCancellable = (bool?) content.GetValueForProperty("IsCancellable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsCancellable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IsDeletable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsDeletable = (bool?) content.GetValueForProperty("IsDeletable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsDeletable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IsShippingAddressEditable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsShippingAddressEditable = (bool?) content.GetValueForProperty("IsShippingAddressEditable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsShippingAddressEditable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).ReverseShippingDetailsUpdate = (string) content.GetValueForProperty("ReverseShippingDetailsUpdate",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).ReverseShippingDetailsUpdate, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).ReverseTransportPreferenceUpdate = (string) content.GetValueForProperty("ReverseTransportPreferenceUpdate",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).ReverseTransportPreferenceUpdate, global::System.Convert.ToString); + } + if (content.Contains("IsPrepareToShipEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsPrepareToShipEnabled = (bool?) content.GetValueForProperty("IsPrepareToShipEnabled",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsPrepareToShipEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("DelayedStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DelayedStage = (string) content.GetValueForProperty("DelayedStage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DelayedStage, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CancellationReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).CancellationReason = (string) content.GetValueForProperty("CancellationReason",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).CancellationReason, global::System.Convert.ToString); + } + if (content.Contains("DeliveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DeliveryType = (string) content.GetValueForProperty("DeliveryType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DeliveryType, global::System.Convert.ToString); + } + if (content.Contains("IsCancellableWithoutFee")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsCancellableWithoutFee = (bool?) content.GetValueForProperty("IsCancellableWithoutFee",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IsCancellableWithoutFee, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AllDevicesLost")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).AllDevicesLost = (bool?) content.GetValueForProperty("AllDevicesLost",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).AllDevicesLost, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Detail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("SkuDisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuDisplayName = (string) content.GetValueForProperty("SkuDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuDisplayName, global::System.Convert.ToString); + } + if (content.Contains("SkuFamily")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuFamily = (string) content.GetValueForProperty("SkuFamily",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuFamily, global::System.Convert.ToString); + } + if (content.Contains("SkuModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuModel = (string) content.GetValueForProperty("SkuModel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).SkuModel, global::System.Convert.ToString); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityType = (string) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityType, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("IdentityUserAssignedIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityUserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities) content.GetValueForProperty("IdentityUserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).IdentityUserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("ErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).ErrorDetail = (System.Collections.Generic.List) content.GetValueForProperty("ErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).ErrorDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("DeliveryInfoScheduledDateTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DeliveryInfoScheduledDateTime = (global::System.DateTime?) content.GetValueForProperty("DeliveryInfoScheduledDateTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal)this).DeliveryInfoScheduledDateTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Job Resource. + [System.ComponentModel.TypeConverter(typeof(JobResourceTypeConverter))] + public partial interface IJobResource + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.TypeConverter.cs new file mode 100644 index 00000000000..ccad370cb73 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobResourceTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobResource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobResource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobResource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.cs new file mode 100644 index 00000000000..487563e788d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.cs @@ -0,0 +1,759 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job Resource. + public partial class JobResource : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TrackedResource(); + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).AdditionalInfo; } + + /// Flag to indicate if all devices associated with the job are lost. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? AllDevicesLost { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).AllDevicesLost; } + + /// Reason for cancellation. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string CancellationReason { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).CancellationReason; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Code; } + + /// Name of the stage where delay might be present. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DelayedStage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).DelayedStage; } + + /// Scheduled date time. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public global::System.DateTime? DeliveryInfoScheduledDateTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).DeliveryInfoScheduledDateTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).DeliveryInfoScheduledDateTime = value ?? default(global::System.DateTime); } + + /// Delivery type of Job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeliveryType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).DeliveryType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).DeliveryType = value ?? null; } + + /// Details of a job run. This field will only be sent for expand details filter. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Detail = value ?? null /* model class */; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List ErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).ErrorDetail; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).Id; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity _identity; + + /// Msi identity of the resource + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentity()); set => this._identity = value; } + + /// Service Principal Id backing the Msi + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).PrincipalId; } + + /// Home Tenant Id + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).TenantId; } + + /// Identity type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).Type = value ?? null; } + + /// User Assigned Identities + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).UserAssignedIdentity; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).UserAssignedIdentity = value ?? null /* model class */; } + + /// Describes whether the job is cancellable or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? IsCancellable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsCancellable; } + + /// Flag to indicate cancellation of scheduled job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? IsCancellableWithoutFee { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsCancellableWithoutFee; } + + /// Describes whether the job is deletable or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? IsDeletable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsDeletable; } + + /// Is Prepare To Ship Enabled on this job + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? IsPrepareToShipEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsPrepareToShipEnabled; } + + /// Describes whether the shipping address is editable or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? IsShippingAddressEditable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsShippingAddressEditable; } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)__trackedResource).Location = value ?? null; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for AllDevicesLost + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.AllDevicesLost { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).AllDevicesLost; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).AllDevicesLost = value ?? default(bool); } + + /// Internal Acessors for CancellationReason + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.CancellationReason { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).CancellationReason; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).CancellationReason = value ?? null; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Code = value ?? null; } + + /// Internal Acessors for DelayedStage + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.DelayedStage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).DelayedStage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).DelayedStage = value ?? null; } + + /// Internal Acessors for DeliveryInfo + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.DeliveryInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).DeliveryInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).DeliveryInfo = value ?? null /* model class */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Error = value ?? null /* model class */; } + + /// Internal Acessors for ErrorDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.ErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).ErrorDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).ErrorDetail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Identity + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentity()); set { {_identity = value;} } } + + /// Internal Acessors for IdentityPrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).PrincipalId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).PrincipalId = value ?? null; } + + /// Internal Acessors for IdentityTenantId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).TenantId = value ?? null; } + + /// Internal Acessors for IsCancellable + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.IsCancellable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsCancellable; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsCancellable = value ?? default(bool); } + + /// Internal Acessors for IsCancellableWithoutFee + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.IsCancellableWithoutFee { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsCancellableWithoutFee; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsCancellableWithoutFee = value ?? default(bool); } + + /// Internal Acessors for IsDeletable + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.IsDeletable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsDeletable; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsDeletable = value ?? default(bool); } + + /// Internal Acessors for IsPrepareToShipEnabled + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.IsPrepareToShipEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsPrepareToShipEnabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsPrepareToShipEnabled = value ?? default(bool); } + + /// Internal Acessors for IsShippingAddressEditable + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.IsShippingAddressEditable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsShippingAddressEditable; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).IsShippingAddressEditable = value ?? default(bool); } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Message = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobProperties()); set { {_property = value;} } } + + /// Internal Acessors for ReverseShippingDetailsUpdate + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.ReverseShippingDetailsUpdate { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).ReverseShippingDetailsUpdate; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).ReverseShippingDetailsUpdate = value ?? null; } + + /// Internal Acessors for ReverseTransportPreferenceUpdate + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.ReverseTransportPreferenceUpdate { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).ReverseTransportPreferenceUpdate; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).ReverseTransportPreferenceUpdate = value ?? null; } + + /// Internal Acessors for Sku + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Sku()); set { {_sku = value;} } } + + /// Internal Acessors for StartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.StartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).StartTime = value ?? default(global::System.DateTime); } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Status = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Target = value ?? null; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).Id = value ?? null; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).Name = value ?? null; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemData = value ?? null /* model class */; } + + /// Internal Acessors for SystemDataCreatedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// Internal Acessors for SystemDataCreatedBy + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } + + /// Internal Acessors for SystemDataCreatedByType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? null; } + + /// Internal Acessors for SystemDataLastModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// Internal Acessors for SystemDataLastModifiedBy + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } + + /// Internal Acessors for SystemDataLastModifiedByType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? null; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).Type = value ?? null; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties _property; + + /// Properties of a job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobProperties()); set => this._property = value; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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); } + + /// The Editable status for Reverse Shipping Address and Contact Info + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsUpdate { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).ReverseShippingDetailsUpdate; } + + /// The Editable status for Reverse Transport preferences + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseTransportPreferenceUpdate { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).ReverseTransportPreferenceUpdate; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku _sku; + + /// The sku type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Sku()); set => this._sku = value; } + + /// The display name of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string SkuDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).DisplayName = value ?? null; } + + /// The sku family. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string SkuFamily { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Family; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Family = value ?? null; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string SkuModel { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Model; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Model = value ?? null; } + + /// The sku name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Name = value ; } + + /// Time at which the job was started in UTC ISO 8601 format. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public global::System.DateTime? StartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).StartTime; } + + /// Name of the stage which is in progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Status; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemData = value ?? null /* model class */; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt; } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).Target; } + + /// Type of the data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransferType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).TransferType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobPropertiesInternal)Property).TransferType = value ; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__trackedResource).Type; } + + /// Creates an new instance. + public JobResource() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// Job Resource. + public partial interface IJobResource : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResource + { + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets additional error info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// Flag to indicate if all devices associated with the job are lost. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Flag to indicate if all devices associated with the job are lost.", + SerializedName = @"allDevicesLost", + PossibleTypes = new [] { typeof(bool) })] + bool? AllDevicesLost { get; } + /// Reason for cancellation. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Reason for cancellation.", + SerializedName = @"cancellationReason", + PossibleTypes = new [] { typeof(string) })] + string CancellationReason { get; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// Name of the stage where delay might be present. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the stage where delay might be present.", + SerializedName = @"delayedStage", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", "ShippedToCustomer")] + string DelayedStage { get; } + /// Scheduled date time. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Scheduled date time.", + SerializedName = @"scheduledDateTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DeliveryInfoScheduledDateTime { get; set; } + /// Delivery type of Job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Delivery type of Job.", + SerializedName = @"deliveryType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("NonScheduled", "Scheduled")] + string DeliveryType { get; set; } + /// Details of a job run. This field will only be sent for expand details filter. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details of a job run. This field will only be sent for expand details filter.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails Detail { get; set; } + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets details for the error.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) })] + System.Collections.Generic.List ErrorDetail { get; } + /// Service Principal Id backing the Msi + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Service Principal Id backing the Msi", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string IdentityPrincipalId { get; } + /// Home Tenant Id + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Home Tenant Id", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string IdentityTenantId { get; } + /// Identity type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Identity type", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string IdentityType { get; set; } + /// User Assigned Identities + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"User Assigned Identities", + SerializedName = @"userAssignedIdentities", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get; set; } + /// Describes whether the job is cancellable or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Describes whether the job is cancellable or not.", + SerializedName = @"isCancellable", + PossibleTypes = new [] { typeof(bool) })] + bool? IsCancellable { get; } + /// Flag to indicate cancellation of scheduled job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Flag to indicate cancellation of scheduled job.", + SerializedName = @"isCancellableWithoutFee", + PossibleTypes = new [] { typeof(bool) })] + bool? IsCancellableWithoutFee { get; } + /// Describes whether the job is deletable or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Describes whether the job is deletable or not.", + SerializedName = @"isDeletable", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDeletable { get; } + /// Is Prepare To Ship Enabled on this job + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Is Prepare To Ship Enabled on this job", + SerializedName = @"isPrepareToShipEnabled", + PossibleTypes = new [] { typeof(bool) })] + bool? IsPrepareToShipEnabled { get; } + /// Describes whether the shipping address is editable or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Describes whether the shipping address is editable or not.", + SerializedName = @"isShippingAddressEditable", + PossibleTypes = new [] { typeof(bool) })] + bool? IsShippingAddressEditable { get; } + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message parsed from the body of the http error response.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The Editable status for Reverse Shipping Address and Contact Info + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The Editable status for Reverse Shipping Address and Contact Info", + SerializedName = @"reverseShippingDetailsUpdate", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled", "NotSupported")] + string ReverseShippingDetailsUpdate { get; } + /// The Editable status for Reverse Transport preferences + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The Editable status for Reverse Transport preferences", + SerializedName = @"reverseTransportPreferenceUpdate", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled", "NotSupported")] + string ReverseTransportPreferenceUpdate { get; } + /// The display name of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The display name of the sku.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string SkuDisplayName { get; set; } + /// The sku family. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The sku family.", + SerializedName = @"family", + PossibleTypes = new [] { typeof(string) })] + string SkuFamily { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string SkuModel { get; set; } + /// The sku name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The sku name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string SkuName { get; set; } + /// Time at which the job was started in UTC ISO 8601 format. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Time at which the job was started in UTC ISO 8601 format.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; } + /// Name of the stage which is in progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the stage which is in progress.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", "ShippedToCustomer")] + string Status { get; } + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the target of the error.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + /// Type of the data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the data transfer.", + SerializedName = @"transferType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; set; } + + } + /// Job Resource. + internal partial interface IJobResourceInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal + { + /// Gets or sets additional error info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// Flag to indicate if all devices associated with the job are lost. + bool? AllDevicesLost { get; set; } + /// Reason for cancellation. + string CancellationReason { get; set; } + /// Error code. + string Code { get; set; } + /// Name of the stage where delay might be present. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", "ShippedToCustomer")] + string DelayedStage { get; set; } + /// Delivery Info of Job. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDeliveryInfo DeliveryInfo { get; set; } + /// Scheduled date time. + global::System.DateTime? DeliveryInfoScheduledDateTime { get; set; } + /// Delivery type of Job. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("NonScheduled", "Scheduled")] + string DeliveryType { get; set; } + /// Details of a job run. This field will only be sent for expand details filter. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails Detail { get; set; } + /// Top level error for the job. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get; set; } + /// Gets or sets details for the error. + System.Collections.Generic.List ErrorDetail { get; set; } + /// Msi identity of the resource + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity Identity { get; set; } + /// Service Principal Id backing the Msi + string IdentityPrincipalId { get; set; } + /// Home Tenant Id + string IdentityTenantId { get; set; } + /// Identity type + string IdentityType { get; set; } + /// User Assigned Identities + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get; set; } + /// Describes whether the job is cancellable or not. + bool? IsCancellable { get; set; } + /// Flag to indicate cancellation of scheduled job. + bool? IsCancellableWithoutFee { get; set; } + /// Describes whether the job is deletable or not. + bool? IsDeletable { get; set; } + /// Is Prepare To Ship Enabled on this job + bool? IsPrepareToShipEnabled { get; set; } + /// Describes whether the shipping address is editable or not. + bool? IsShippingAddressEditable { get; set; } + /// The error message parsed from the body of the http error response. + string Message { get; set; } + /// Properties of a job. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobProperties Property { get; set; } + /// The Editable status for Reverse Shipping Address and Contact Info + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled", "NotSupported")] + string ReverseShippingDetailsUpdate { get; set; } + /// The Editable status for Reverse Transport preferences + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled", "NotSupported")] + string ReverseTransportPreferenceUpdate { get; set; } + /// The sku type. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku Sku { get; set; } + /// The display name of the sku. + string SkuDisplayName { get; set; } + /// The sku family. + string SkuFamily { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string SkuModel { get; set; } + /// The sku name. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string SkuName { get; set; } + /// Time at which the job was started in UTC ISO 8601 format. + global::System.DateTime? StartTime { get; set; } + /// Name of the stage which is in progress. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", "ShippedToCustomer")] + string Status { get; set; } + /// Gets or sets the target of the error. + string Target { get; set; } + /// Type of the data transfer. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.json.cs new file mode 100644 index 00000000000..6af860c2634 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResource.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job Resource. + public partial class JobResource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new JobResource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal JobResource(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobProperties.FromJson(__jsonProperties) : _property;} + {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Sku.FromJson(__jsonSku) : _sku;} + {_identity = If( json?.PropertyT("identity"), out var __jsonIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentity.FromJson(__jsonIdentity) : _identity;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._sku ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._sku.ToJson(null,serializationMode) : null, "sku" ,container.Add ); + AddIf( null != this._identity ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._identity.ToJson(null,serializationMode) : null, "identity" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.PowerShell.cs new file mode 100644 index 00000000000..11a468db431 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Job Resource Collection + [System.ComponentModel.TypeConverter(typeof(JobResourceListTypeConverter))] + public partial class JobResourceList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobResourceList(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.DataBox.Models.IJobResourceList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobResourceList(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.DataBox.Models.IJobResourceList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobResourceList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceListInternal)this).NextLink, 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 JobResourceList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceListInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Job Resource Collection + [System.ComponentModel.TypeConverter(typeof(JobResourceListTypeConverter))] + public partial interface IJobResourceList + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.TypeConverter.cs new file mode 100644 index 00000000000..53aca407e25 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobResourceListTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobResourceList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobResourceList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobResourceList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.cs new file mode 100644 index 00000000000..3deea82603c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job Resource Collection + public partial class JobResourceList : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceList, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceListInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to the next page of items + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// The JobResource items on this page + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public JobResourceList() + { + + } + } + /// Job Resource Collection + public partial interface IJobResourceList : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// The link to the next page of items + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.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) })] + string NextLink { get; set; } + /// The JobResource items on this page + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The JobResource items on this page", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource) })] + System.Collections.Generic.List Value { get; set; } + + } + /// Job Resource Collection + internal partial interface IJobResourceListInternal + + { + /// The link to the next page of items + string NextLink { get; set; } + /// The JobResource items on this page + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.json.cs new file mode 100644 index 00000000000..2b122186945 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceList.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job Resource Collection + public partial class JobResourceList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceList FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new JobResourceList(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal JobResourceList(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IJobResource) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResource.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.PowerShell.cs new file mode 100644 index 00000000000..78a60c9022a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.PowerShell.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The JobResourceUpdateParameter. + [System.ComponentModel.TypeConverter(typeof(JobResourceUpdateParameterTypeConverter))] + public partial class JobResourceUpdateParameter + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobResourceUpdateParameter(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.DataBox.Models.IJobResourceUpdateParameter DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobResourceUpdateParameter(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.DataBox.Models.IJobResourceUpdateParameter FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobResourceUpdateParameter(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UpdateJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceUpdateParameterTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Detail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UpdateJobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityType = (string) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityType, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("IdentityUserAssignedIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityUserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities) content.GetValueForProperty("IdentityUserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityUserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobResourceUpdateParameter(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UpdateJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceUpdateParameterTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).Detail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UpdateJobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityType = (string) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityType, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("IdentityUserAssignedIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityUserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities) content.GetValueForProperty("IdentityUserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal)this).IdentityUserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 JobResourceUpdateParameter. + [System.ComponentModel.TypeConverter(typeof(JobResourceUpdateParameterTypeConverter))] + public partial interface IJobResourceUpdateParameter + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.TypeConverter.cs new file mode 100644 index 00000000000..de470fff47a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobResourceUpdateParameterTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobResourceUpdateParameter.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobResourceUpdateParameter.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobResourceUpdateParameter.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.cs new file mode 100644 index 00000000000..4020392d1a0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The JobResourceUpdateParameter. + public partial class JobResourceUpdateParameter : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal + { + + /// Details of a job to be updated. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobPropertiesInternal)Property).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobPropertiesInternal)Property).Detail = value ?? null /* model class */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity _identity; + + /// Msi identity of the resource + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentity()); set => this._identity = value; } + + /// Service Principal Id backing the Msi + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).PrincipalId; } + + /// Home Tenant Id + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).TenantId; } + + /// Identity type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).Type = value ?? null; } + + /// User Assigned Identities + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).UserAssignedIdentity; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).UserAssignedIdentity = value ?? null /* model class */; } + + /// Internal Acessors for Identity + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal.Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentity()); set { {_identity = value;} } } + + /// Internal Acessors for IdentityPrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal.IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).PrincipalId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).PrincipalId = value ?? null; } + + /// Internal Acessors for IdentityTenantId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal.IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)Identity).TenantId = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UpdateJobProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties _property; + + /// Properties of a job to be updated. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UpdateJobProperties()); set => this._property = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags _tag; + + /// + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across + /// resource groups). + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceUpdateParameterTags()); set => this._tag = value; } + + /// Creates an new instance. + public JobResourceUpdateParameter() + { + + } + } + /// The JobResourceUpdateParameter. + public partial interface IJobResourceUpdateParameter : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Details of a job to be updated. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details of a job to be updated.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails Detail { get; set; } + /// Service Principal Id backing the Msi + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Service Principal Id backing the Msi", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string IdentityPrincipalId { get; } + /// Home Tenant Id + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Home Tenant Id", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string IdentityTenantId { get; } + /// Identity type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Identity type", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string IdentityType { get; set; } + /// User Assigned Identities + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"User Assigned Identities", + SerializedName = @"userAssignedIdentities", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get; set; } + /// + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across + /// resource groups). + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags Tag { get; set; } + + } + /// The JobResourceUpdateParameter. + internal partial interface IJobResourceUpdateParameterInternal + + { + /// Details of a job to be updated. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails Detail { get; set; } + /// Msi identity of the resource + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity Identity { get; set; } + /// Service Principal Id backing the Msi + string IdentityPrincipalId { get; set; } + /// Home Tenant Id + string IdentityTenantId { get; set; } + /// Identity type + string IdentityType { get; set; } + /// User Assigned Identities + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get; set; } + /// Properties of a job to be updated. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties Property { get; set; } + /// + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across + /// resource groups). + /// + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.json.cs new file mode 100644 index 00000000000..d7a81d5de19 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameter.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The JobResourceUpdateParameter. + public partial class JobResourceUpdateParameter + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new JobResourceUpdateParameter(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal JobResourceUpdateParameter(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UpdateJobProperties.FromJson(__jsonProperties) : _property;} + {_identity = If( json?.PropertyT("identity"), out var __jsonIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentity.FromJson(__jsonIdentity) : _identity;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceUpdateParameterTags.FromJson(__jsonTags) : _tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._identity ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._identity.ToJson(null,serializationMode) : null, "identity" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.PowerShell.cs new file mode 100644 index 00000000000..1d2658cf69d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across + /// resource groups). + /// + [System.ComponentModel.TypeConverter(typeof(JobResourceUpdateParameterTagsTypeConverter))] + public partial class JobResourceUpdateParameterTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobResourceUpdateParameterTags(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.DataBox.Models.IJobResourceUpdateParameterTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobResourceUpdateParameterTags(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.DataBox.Models.IJobResourceUpdateParameterTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobResourceUpdateParameterTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobResourceUpdateParameterTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across + /// resource groups). + [System.ComponentModel.TypeConverter(typeof(JobResourceUpdateParameterTagsTypeConverter))] + public partial interface IJobResourceUpdateParameterTags + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.TypeConverter.cs new file mode 100644 index 00000000000..6db4f575625 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobResourceUpdateParameterTagsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobResourceUpdateParameterTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobResourceUpdateParameterTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobResourceUpdateParameterTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.cs new file mode 100644 index 00000000000..bca5d9624bb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across + /// resource groups). + /// + public partial class JobResourceUpdateParameterTags : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTagsInternal + { + + /// Creates an new instance. + public JobResourceUpdateParameterTags() + { + + } + } + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across + /// resource groups). + public partial interface IJobResourceUpdateParameterTags : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + + } + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across + /// resource groups). + internal partial interface IJobResourceUpdateParameterTagsInternal + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.dictionary.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.dictionary.cs new file mode 100644 index 00000000000..eaac9f847b6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.dictionary.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class JobResourceUpdateParameterTags : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceUpdateParameterTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.json.cs new file mode 100644 index 00000000000..3fb97a9aa4a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobResourceUpdateParameterTags.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across + /// resource groups). + /// + public partial class JobResourceUpdateParameterTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new JobResourceUpdateParameterTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + /// + internal JobResourceUpdateParameterTags(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.PowerShell.cs new file mode 100644 index 00000000000..734d688e9bf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.PowerShell.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The base class for the secrets + [System.ComponentModel.TypeConverter(typeof(JobSecretsTypeConverter))] + public partial class JobSecrets + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobSecrets(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.DataBox.Models.IJobSecrets DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobSecrets(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.DataBox.Models.IJobSecrets FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobSecrets(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DcAccessSecurityCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode) content.GetValueForProperty("DcAccessSecurityCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCodeTypeConverter.ConvertFrom); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target, 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 JobSecrets(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DcAccessSecurityCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode) content.GetValueForProperty("DcAccessSecurityCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCode, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCodeTypeConverter.ConvertFrom); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).DcAccessSecurityCodeForwardDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)this).Target, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 base class for the secrets + [System.ComponentModel.TypeConverter(typeof(JobSecretsTypeConverter))] + public partial interface IJobSecrets + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.TypeConverter.cs new file mode 100644 index 00000000000..fddf32f9f36 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobSecretsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobSecrets.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobSecrets.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobSecrets.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.cs new file mode 100644 index 00000000000..15a39af4465 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The base class for the secrets + public partial class JobSecrets : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal + { + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode _dcAccessSecurityCode; + + /// Dc Access Security Code for Customer Managed Shipping + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode DcAccessSecurityCode { get => (this._dcAccessSecurityCode = this._dcAccessSecurityCode ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCode()); } + + /// Forward Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DcAccessSecurityCodeForwardDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)DcAccessSecurityCode).ForwardDcAccessCode; } + + /// Reverse Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DcAccessSecurityCodeReverseDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)DcAccessSecurityCode).ReverseDcAccessCode; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError _error; + + /// Error while fetching the secrets. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError()); } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code = value ?? null; } + + /// Internal Acessors for DcAccessSecurityCode + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCode { get => (this._dcAccessSecurityCode = this._dcAccessSecurityCode ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCode()); set { {_dcAccessSecurityCode = value;} } } + + /// Internal Acessors for DcAccessSecurityCodeForwardDcAccessCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCodeForwardDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)DcAccessSecurityCode).ForwardDcAccessCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)DcAccessSecurityCode).ForwardDcAccessCode = value ?? null; } + + /// Internal Acessors for DcAccessSecurityCodeReverseDcAccessCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.DcAccessSecurityCodeReverseDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)DcAccessSecurityCode).ReverseDcAccessCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCodeInternal)DcAccessSecurityCode).ReverseDcAccessCode = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError()); set { {_error = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target = value ?? null; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target; } + + /// Backing field for property. + private string _type; + + /// Used to indicate what type of job secrets object. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public JobSecrets() + { + + } + } + /// The base class for the secrets + public partial interface IJobSecrets : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets additional error info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// Forward Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Forward Dc access security code.", + SerializedName = @"forwardDCAccessCode", + PossibleTypes = new [] { typeof(string) })] + string DcAccessSecurityCodeForwardDcAccessCode { get; } + /// Reverse Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Reverse Dc access security code.", + SerializedName = @"reverseDCAccessCode", + PossibleTypes = new [] { typeof(string) })] + string DcAccessSecurityCodeReverseDcAccessCode { get; } + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets details for the error.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) })] + System.Collections.Generic.List Detail { get; } + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message parsed from the body of the http error response.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the target of the error.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + /// Used to indicate what type of job secrets object. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Used to indicate what type of job secrets object.", + SerializedName = @"jobSecretsType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string Type { get; set; } + + } + /// The base class for the secrets + internal partial interface IJobSecretsInternal + + { + /// Gets or sets additional error info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// Error code. + string Code { get; set; } + /// Dc Access Security Code for Customer Managed Shipping + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode DcAccessSecurityCode { get; set; } + /// Forward Dc access security code. + string DcAccessSecurityCodeForwardDcAccessCode { get; set; } + /// Reverse Dc access security code. + string DcAccessSecurityCodeReverseDcAccessCode { get; set; } + /// Gets or sets details for the error. + System.Collections.Generic.List Detail { get; set; } + /// Error while fetching the secrets. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get; set; } + /// The error message parsed from the body of the http error response. + string Message { get; set; } + /// Gets or sets the target of the error. + string Target { get; set; } + /// Used to indicate what type of job secrets object. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.json.cs new file mode 100644 index 00000000000..067be73d9a2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobSecrets.json.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The base class for the secrets + public partial class JobSecrets + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets interface is polymorphic, and the precise model + /// class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("jobSecretsType") ) + { + case "DataBoxCustomerDisk": + { + return new CustomerDiskJobSecrets(json); + } + case "DataBoxDisk": + { + return new DataBoxDiskJobSecrets(json); + } + case "DataBoxHeavy": + { + return new DataBoxHeavyJobSecrets(json); + } + case "DataBox": + { + return new DataboxJobSecrets(json); + } + } + return new JobSecrets(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal JobSecrets(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_dcAccessSecurityCode = If( json?.PropertyT("dcAccessSecurityCode"), out var __jsonDcAccessSecurityCode) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCode.FromJson(__jsonDcAccessSecurityCode) : _dcAccessSecurityCode;} + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError.FromJson(__jsonError) : _error;} + {_type = If( json?.PropertyT("jobSecretsType"), out var __jsonJobSecretsType) ? (string)__jsonJobSecretsType : (string)_type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._dcAccessSecurityCode ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._dcAccessSecurityCode.ToJson(null,serializationMode) : null, "dcAccessSecurityCode" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._type.ToString()) : null, "jobSecretsType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.PowerShell.cs new file mode 100644 index 00000000000..6c5c9a37654 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Job stages. + [System.ComponentModel.TypeConverter(typeof(JobStagesTypeConverter))] + public partial class JobStages + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStages DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobStages(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.DataBox.Models.IJobStages DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobStages(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.DataBox.Models.IJobStages FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobStages(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StageName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).StageName = (string) content.GetValueForProperty("StageName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).StageName, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("StageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).StageStatus = (string) content.GetValueForProperty("StageStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).StageStatus, global::System.Convert.ToString); + } + if (content.Contains("StageTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).StageTime = (global::System.DateTime?) content.GetValueForProperty("StageTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).StageTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("JobStageDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).JobStageDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny) content.GetValueForProperty("JobStageDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).JobStageDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AnyTypeConverter.ConvertFrom); + } + if (content.Contains("DelayInformation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).DelayInformation = (System.Collections.Generic.List) content.GetValueForProperty("DelayInformation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).DelayInformation, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDelayDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobStages(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StageName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).StageName = (string) content.GetValueForProperty("StageName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).StageName, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("StageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).StageStatus = (string) content.GetValueForProperty("StageStatus",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).StageStatus, global::System.Convert.ToString); + } + if (content.Contains("StageTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).StageTime = (global::System.DateTime?) content.GetValueForProperty("StageTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).StageTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("JobStageDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).JobStageDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny) content.GetValueForProperty("JobStageDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).JobStageDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AnyTypeConverter.ConvertFrom); + } + if (content.Contains("DelayInformation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).DelayInformation = (System.Collections.Generic.List) content.GetValueForProperty("DelayInformation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal)this).DelayInformation, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDelayDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Job stages. + [System.ComponentModel.TypeConverter(typeof(JobStagesTypeConverter))] + public partial interface IJobStages + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.TypeConverter.cs new file mode 100644 index 00000000000..96df7522c5d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobStagesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStages ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStages).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobStages.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobStages.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobStages.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.cs new file mode 100644 index 00000000000..01099a29c63 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job stages. + public partial class JobStages : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStages, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _delayInformation; + + /// Delay information for the job stages. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List DelayInformation { get => this._delayInformation; } + + /// Backing field for property. + private string _displayName; + + /// Display name of the job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DisplayName { get => this._displayName; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny _jobStageDetail; + + /// Job Stage Details + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny JobStageDetail { get => (this._jobStageDetail = this._jobStageDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Any()); } + + /// Internal Acessors for DelayInformation + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal.DelayInformation { get => this._delayInformation; set { {_delayInformation = value;} } } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + + /// Internal Acessors for JobStageDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal.JobStageDetail { get => (this._jobStageDetail = this._jobStageDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Any()); set { {_jobStageDetail = value;} } } + + /// Internal Acessors for StageName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal.StageName { get => this._stageName; set { {_stageName = value;} } } + + /// Internal Acessors for StageStatus + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal.StageStatus { get => this._stageStatus; set { {_stageStatus = value;} } } + + /// Internal Acessors for StageTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStagesInternal.StageTime { get => this._stageTime; set { {_stageTime = value;} } } + + /// Backing field for property. + private string _stageName; + + /// Name of the job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StageName { get => this._stageName; } + + /// Backing field for property. + private string _stageStatus; + + /// Status of the job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StageStatus { get => this._stageStatus; } + + /// Backing field for property. + private global::System.DateTime? _stageTime; + + /// Time for the job stage in UTC ISO 8601 format. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public global::System.DateTime? StageTime { get => this._stageTime; } + + /// Creates an new instance. + public JobStages() + { + + } + } + /// Job stages. + public partial interface IJobStages : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Delay information for the job stages. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Delay information for the job stages.", + SerializedName = @"delayInformation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDelayDetails) })] + System.Collections.Generic.List DelayInformation { get; } + /// Display name of the job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Display name of the job stage.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; } + /// Job Stage Details + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Job Stage Details", + SerializedName = @"jobStageDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny JobStageDetail { get; } + /// Name of the job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the job stage.", + SerializedName = @"stageName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", "ShippedToCustomer")] + string StageName { get; } + /// Status of the job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Status of the job stage.", + SerializedName = @"stageStatus", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "InProgress", "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", "CustomerActionPerformed")] + string StageStatus { get; } + /// Time for the job stage in UTC ISO 8601 format. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Time for the job stage in UTC ISO 8601 format.", + SerializedName = @"stageTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StageTime { get; } + + } + /// Job stages. + internal partial interface IJobStagesInternal + + { + /// Delay information for the job stages. + System.Collections.Generic.List DelayInformation { get; set; } + /// Display name of the job stage. + string DisplayName { get; set; } + /// Job Stage Details + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAny JobStageDetail { get; set; } + /// Name of the job stage. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", "ShippedToCustomer")] + string StageName { get; set; } + /// Status of the job stage. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "InProgress", "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", "CustomerActionPerformed")] + string StageStatus { get; set; } + /// Time for the job stage in UTC ISO 8601 format. + global::System.DateTime? StageTime { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.json.cs new file mode 100644 index 00000000000..b0a21fdf1bd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/JobStages.json.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job stages. + public partial class JobStages + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStages. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStages. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobStages FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new JobStages(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal JobStages(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_stageName = If( json?.PropertyT("stageName"), out var __jsonStageName) ? (string)__jsonStageName : (string)_stageName;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)_displayName;} + {_stageStatus = If( json?.PropertyT("stageStatus"), out var __jsonStageStatus) ? (string)__jsonStageStatus : (string)_stageStatus;} + {_stageTime = If( json?.PropertyT("stageTime"), out var __jsonStageTime) ? global::System.DateTime.TryParse((string)__jsonStageTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStageTimeValue) ? __jsonStageTimeValue : _stageTime : _stageTime;} + {_jobStageDetail = If( json?.PropertyT("jobStageDetails"), out var __jsonJobStageDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Any.FromJson(__jsonJobStageDetails) : _jobStageDetail;} + {_delayInformation = If( json?.PropertyT("delayInformation"), out var __jsonDelayInformation) ? If( __jsonDelayInformation as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IJobDelayDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobDelayDetails.FromJson(__u) )) ))() : null : _delayInformation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._stageName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._stageName.ToString()) : null, "stageName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._stageStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._stageStatus.ToString()) : null, "stageStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._stageTime ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._stageTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "stageTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._jobStageDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._jobStageDetail.ToJson(null,serializationMode) : null, "jobStageDetails" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._delayInformation) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._delayInformation ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("delayInformation",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.PowerShell.cs new file mode 100644 index 00000000000..d79629b82ca --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.PowerShell.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Encryption key containing details about key to encrypt different keys. + [System.ComponentModel.TypeConverter(typeof(KeyEncryptionKeyTypeConverter))] + public partial class KeyEncryptionKey + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new KeyEncryptionKey(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.DataBox.Models.IKeyEncryptionKey DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new KeyEncryptionKey(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.DataBox.Models.IKeyEncryptionKey FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal KeyEncryptionKey(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).IdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("IdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).IdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).KekType = (string) content.GetValueForProperty("KekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).KekType, global::System.Convert.ToString); + } + if (content.Contains("KekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).KekUrl = (string) content.GetValueForProperty("KekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).KekUrl, global::System.Convert.ToString); + } + if (content.Contains("KekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).KekVaultResourceId = (string) content.GetValueForProperty("KekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).KekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).UserAssignedResourceId, 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 KeyEncryptionKey(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).IdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("IdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).IdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).KekType = (string) content.GetValueForProperty("KekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).KekType, global::System.Convert.ToString); + } + if (content.Contains("KekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).KekUrl = (string) content.GetValueForProperty("KekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).KekUrl, global::System.Convert.ToString); + } + if (content.Contains("KekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).KekVaultResourceId = (string) content.GetValueForProperty("KekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).KekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)this).UserAssignedResourceId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Encryption key containing details about key to encrypt different keys. + [System.ComponentModel.TypeConverter(typeof(KeyEncryptionKeyTypeConverter))] + public partial interface IKeyEncryptionKey + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.TypeConverter.cs new file mode 100644 index 00000000000..9fd1d8d6bc0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class KeyEncryptionKeyTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return KeyEncryptionKey.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return KeyEncryptionKey.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return KeyEncryptionKey.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.cs new file mode 100644 index 00000000000..83f4ae3efbe --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Encryption key containing details about key to encrypt different keys. + public partial class KeyEncryptionKey : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties _identityProperty; + + /// Managed identity properties used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties IdentityProperty { get => (this._identityProperty = this._identityProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityProperties()); set => this._identityProperty = value; } + + /// Managed service identity type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string IdentityPropertyType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)IdentityProperty).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)IdentityProperty).Type = value ?? null; } + + /// Backing field for property. + private string _kekType; + + /// Type of encryption key used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string KekType { get => this._kekType; set => this._kekType = value; } + + /// Backing field for property. + private string _kekUrl; + + /// Key encryption key. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string KekUrl { get => this._kekUrl; set => this._kekUrl = value; } + + /// Backing field for property. + private string _kekVaultResourceId; + + /// Kek vault resource id. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string KekVaultResourceId { get => this._kekVaultResourceId; set => this._kekVaultResourceId = value; } + + /// Internal Acessors for IdentityProperty + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal.IdentityProperty { get => (this._identityProperty = this._identityProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityProperties()); set { {_identityProperty = value;} } } + + /// Internal Acessors for IdentityPropertyUserAssigned + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal.IdentityPropertyUserAssigned { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)IdentityProperty).UserAssigned; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)IdentityProperty).UserAssigned = value ?? null /* model class */; } + + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string UserAssignedResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)IdentityProperty).UserAssignedResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityPropertiesInternal)IdentityProperty).UserAssignedResourceId = value ?? null; } + + /// Creates an new instance. + public KeyEncryptionKey() + { + + } + } + /// Encryption key containing details about key to encrypt different keys. + public partial interface IKeyEncryptionKey : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Managed service identity type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Managed service identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string IdentityPropertyType { get; set; } + /// Type of encryption key used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of encryption key used for key encryption.", + SerializedName = @"kekType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("MicrosoftManaged", "CustomerManaged")] + string KekType { get; set; } + /// Key encryption key. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Key encryption key. It is required in case of Customer managed KekType.", + SerializedName = @"kekUrl", + PossibleTypes = new [] { typeof(string) })] + string KekUrl { get; set; } + /// Kek vault resource id. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Kek vault resource id. It is required in case of Customer managed KekType.", + SerializedName = @"kekVaultResourceID", + PossibleTypes = new [] { typeof(string) })] + string KekVaultResourceId { get; set; } + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Arm resource id for user assigned identity to be used to fetch MSI token.", + SerializedName = @"resourceId", + PossibleTypes = new [] { typeof(string) })] + string UserAssignedResourceId { get; set; } + + } + /// Encryption key containing details about key to encrypt different keys. + internal partial interface IKeyEncryptionKeyInternal + + { + /// Managed identity properties used for key encryption. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties IdentityProperty { get; set; } + /// Managed service identity type. + string IdentityPropertyType { get; set; } + /// User assigned identity properties. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties IdentityPropertyUserAssigned { get; set; } + /// Type of encryption key used for key encryption. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("MicrosoftManaged", "CustomerManaged")] + string KekType { get; set; } + /// Key encryption key. It is required in case of Customer managed KekType. + string KekUrl { get; set; } + /// Kek vault resource id. It is required in case of Customer managed KekType. + string KekVaultResourceId { get; set; } + /// Arm resource id for user assigned identity to be used to fetch MSI token. + string UserAssignedResourceId { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.json.cs new file mode 100644 index 00000000000..1ba579419c4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/KeyEncryptionKey.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Encryption key containing details about key to encrypt different keys. + public partial class KeyEncryptionKey + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new KeyEncryptionKey(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal KeyEncryptionKey(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_identityProperty = If( json?.PropertyT("identityProperties"), out var __jsonIdentityProperties) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityProperties.FromJson(__jsonIdentityProperties) : _identityProperty;} + {_kekType = If( json?.PropertyT("kekType"), out var __jsonKekType) ? (string)__jsonKekType : (string)_kekType;} + {_kekUrl = If( json?.PropertyT("kekUrl"), out var __jsonKekUrl) ? (string)__jsonKekUrl : (string)_kekUrl;} + {_kekVaultResourceId = If( json?.PropertyT("kekVaultResourceID"), out var __jsonKekVaultResourceId) ? (string)__jsonKekVaultResourceId : (string)_kekVaultResourceId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._identityProperty ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._identityProperty.ToJson(null,serializationMode) : null, "identityProperties" ,container.Add ); + AddIf( null != (((object)this._kekType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._kekType.ToString()) : null, "kekType" ,container.Add ); + AddIf( null != (((object)this._kekUrl)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._kekUrl.ToString()) : null, "kekUrl" ,container.Add ); + AddIf( null != (((object)this._kekVaultResourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._kekVaultResourceId.ToString()) : null, "kekVaultResourceID" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.PowerShell.cs new file mode 100644 index 00000000000..6b675f04d1d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Last Mitigation Action Performed On Job + [System.ComponentModel.TypeConverter(typeof(LastMitigationActionOnJobTypeConverter))] + public partial class LastMitigationActionOnJob + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LastMitigationActionOnJob(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.DataBox.Models.ILastMitigationActionOnJob DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LastMitigationActionOnJob(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.DataBox.Models.ILastMitigationActionOnJob FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LastMitigationActionOnJob(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ActionDateTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)this).ActionDateTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("ActionDateTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)this).ActionDateTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IsPerformedByCustomer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)this).IsPerformedByCustomer = (bool?) content.GetValueForProperty("IsPerformedByCustomer",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)this).IsPerformedByCustomer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CustomerResolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)this).CustomerResolution = (string) content.GetValueForProperty("CustomerResolution",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)this).CustomerResolution, 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 LastMitigationActionOnJob(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ActionDateTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)this).ActionDateTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("ActionDateTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)this).ActionDateTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IsPerformedByCustomer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)this).IsPerformedByCustomer = (bool?) content.GetValueForProperty("IsPerformedByCustomer",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)this).IsPerformedByCustomer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CustomerResolution")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)this).CustomerResolution = (string) content.GetValueForProperty("CustomerResolution",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal)this).CustomerResolution, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Last Mitigation Action Performed On Job + [System.ComponentModel.TypeConverter(typeof(LastMitigationActionOnJobTypeConverter))] + public partial interface ILastMitigationActionOnJob + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.TypeConverter.cs new file mode 100644 index 00000000000..12d05bbbdd9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LastMitigationActionOnJobTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LastMitigationActionOnJob.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LastMitigationActionOnJob.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LastMitigationActionOnJob.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.cs new file mode 100644 index 00000000000..0648e8c675c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Last Mitigation Action Performed On Job + public partial class LastMitigationActionOnJob : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJobInternal + { + + /// Backing field for property. + private global::System.DateTime? _actionDateTimeInUtc; + + /// Action performed date time + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public global::System.DateTime? ActionDateTimeInUtc { get => this._actionDateTimeInUtc; set => this._actionDateTimeInUtc = value; } + + /// Backing field for property. + private string _customerResolution; + + /// Resolution code provided by customer + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CustomerResolution { get => this._customerResolution; set => this._customerResolution = value; } + + /// Backing field for property. + private bool? _isPerformedByCustomer; + + /// + /// Action performed by customer, + /// possibility is that mitigation might happen by customer or service or by ops + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? IsPerformedByCustomer { get => this._isPerformedByCustomer; set => this._isPerformedByCustomer = value; } + + /// Creates an new instance. + public LastMitigationActionOnJob() + { + + } + } + /// Last Mitigation Action Performed On Job + public partial interface ILastMitigationActionOnJob : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Action performed date time + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Action performed date time", + SerializedName = @"actionDateTimeInUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ActionDateTimeInUtc { get; set; } + /// Resolution code provided by customer + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Resolution code provided by customer", + SerializedName = @"customerResolution", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + string CustomerResolution { get; set; } + /// + /// Action performed by customer, + /// possibility is that mitigation might happen by customer or service or by ops + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Action performed by customer, + possibility is that mitigation might happen by customer or service or by ops", + SerializedName = @"isPerformedByCustomer", + PossibleTypes = new [] { typeof(bool) })] + bool? IsPerformedByCustomer { get; set; } + + } + /// Last Mitigation Action Performed On Job + internal partial interface ILastMitigationActionOnJobInternal + + { + /// Action performed date time + global::System.DateTime? ActionDateTimeInUtc { get; set; } + /// Resolution code provided by customer + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + string CustomerResolution { get; set; } + /// + /// Action performed by customer, + /// possibility is that mitigation might happen by customer or service or by ops + /// + bool? IsPerformedByCustomer { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.json.cs new file mode 100644 index 00000000000..d65bbcefc1d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/LastMitigationActionOnJob.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Last Mitigation Action Performed On Job + public partial class LastMitigationActionOnJob + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ILastMitigationActionOnJob FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new LastMitigationActionOnJob(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal LastMitigationActionOnJob(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_actionDateTimeInUtc = If( json?.PropertyT("actionDateTimeInUtc"), out var __jsonActionDateTimeInUtc) ? global::System.DateTime.TryParse((string)__jsonActionDateTimeInUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonActionDateTimeInUtcValue) ? __jsonActionDateTimeInUtcValue : _actionDateTimeInUtc : _actionDateTimeInUtc;} + {_isPerformedByCustomer = If( json?.PropertyT("isPerformedByCustomer"), out var __jsonIsPerformedByCustomer) ? (bool?)__jsonIsPerformedByCustomer : _isPerformedByCustomer;} + {_customerResolution = If( json?.PropertyT("customerResolution"), out var __jsonCustomerResolution) ? (string)__jsonCustomerResolution : (string)_customerResolution;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._actionDateTimeInUtc ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._actionDateTimeInUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "actionDateTimeInUtc" ,container.Add ); + AddIf( null != this._isPerformedByCustomer ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._isPerformedByCustomer) : null, "isPerformedByCustomer" ,container.Add ); + AddIf( null != (((object)this._customerResolution)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._customerResolution.ToString()) : null, "customerResolution" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.PowerShell.cs new file mode 100644 index 00000000000..2cb259738fa --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Details of the managed disks. + [System.ComponentModel.TypeConverter(typeof(ManagedDiskDetailsTypeConverter))] + public partial class ManagedDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ManagedDiskDetails(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.DataBox.Models.IManagedDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ManagedDiskDetails(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.DataBox.Models.IManagedDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ManagedDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetailsInternal)this).ResourceGroupId = (string) content.GetValueForProperty("ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetailsInternal)this).ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("StagingStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetailsInternal)this).StagingStorageAccountId = (string) content.GetValueForProperty("StagingStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetailsInternal)this).StagingStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("SharePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).SharePassword = (System.Security.SecureString) content.GetValueForProperty("SharePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).SharePassword, (object ss) => (System.Security.SecureString)ss); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ManagedDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetailsInternal)this).ResourceGroupId = (string) content.GetValueForProperty("ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetailsInternal)this).ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("StagingStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetailsInternal)this).StagingStorageAccountId = (string) content.GetValueForProperty("StagingStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetailsInternal)this).StagingStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("SharePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).SharePassword = (System.Security.SecureString) content.GetValueForProperty("SharePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).SharePassword, (object ss) => (System.Security.SecureString)ss); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Details of the managed disks. + [System.ComponentModel.TypeConverter(typeof(ManagedDiskDetailsTypeConverter))] + public partial interface IManagedDiskDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.TypeConverter.cs new file mode 100644 index 00000000000..46b17b2b9cd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ManagedDiskDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ManagedDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ManagedDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ManagedDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.cs new file mode 100644 index 00000000000..a23d8d56e7b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details of the managed disks. + public partial class ManagedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails __dataAccountDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetails(); + + /// Account Type of the data to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DataAccountType { get => "ManagedDisk"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)__dataAccountDetails).DataAccountType = "ManagedDisk"; } + + /// Backing field for property. + private string _resourceGroupId; + + /// Resource Group Id of the compute disks. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ResourceGroupId { get => this._resourceGroupId; set => this._resourceGroupId = value; } + + /// + /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If + /// this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements + /// : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one + /// number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, + /// numbers and these characters : @#\-$%^!+=;:_()]+ + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Security.SecureString SharePassword { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)__dataAccountDetails).SharePassword; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)__dataAccountDetails).SharePassword = value ?? null; } + + /// Backing field for property. + private string _stagingStorageAccountId; + + /// + /// Resource Id of the storage account that can be used to copy the vhd for staging. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StagingStorageAccountId { get => this._stagingStorageAccountId; set => this._stagingStorageAccountId = value; } + + /// Creates an new instance. + public ManagedDiskDetails() + { + this.__dataAccountDetails.DataAccountType = "ManagedDisk"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__dataAccountDetails), __dataAccountDetails); + await eventListener.AssertObjectIsValid(nameof(__dataAccountDetails), __dataAccountDetails); + } + } + /// Details of the managed disks. + public partial interface IManagedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails + { + /// Resource Group Id of the compute disks. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Resource Group Id of the compute disks.", + SerializedName = @"resourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string ResourceGroupId { get; set; } + /// + /// Resource Id of the storage account that can be used to copy the vhd for staging. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Resource Id of the storage account that can be used to copy the vhd for staging.", + SerializedName = @"stagingStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StagingStorageAccountId { get; set; } + + } + /// Details of the managed disks. + internal partial interface IManagedDiskDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal + { + /// Resource Group Id of the compute disks. + string ResourceGroupId { get; set; } + /// + /// Resource Id of the storage account that can be used to copy the vhd for staging. + /// + string StagingStorageAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.json.cs new file mode 100644 index 00000000000..70071bb20b8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ManagedDiskDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details of the managed disks. + public partial class ManagedDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IManagedDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ManagedDiskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ManagedDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __dataAccountDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetails(json); + {_resourceGroupId = If( json?.PropertyT("resourceGroupId"), out var __jsonResourceGroupId) ? (string)__jsonResourceGroupId : (string)_resourceGroupId;} + {_stagingStorageAccountId = If( json?.PropertyT("stagingStorageAccountId"), out var __jsonStagingStorageAccountId) ? (string)__jsonStagingStorageAccountId : (string)_stagingStorageAccountId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __dataAccountDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._resourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._resourceGroupId.ToString()) : null, "resourceGroupId" ,container.Add ); + AddIf( null != (((object)this._stagingStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._stagingStorageAccountId.ToString()) : null, "stagingStorageAccountId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.PowerShell.cs new file mode 100644 index 00000000000..0baa0119710 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The request body to provide the delivery package details of job + [System.ComponentModel.TypeConverter(typeof(MarkDevicesShippedRequestTypeConverter))] + public partial class MarkDevicesShippedRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MarkDevicesShippedRequest(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.DataBox.Models.IMarkDevicesShippedRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MarkDevicesShippedRequest(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.DataBox.Models.IMarkDevicesShippedRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MarkDevicesShippedRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeliverToDcPackageDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal)this).DeliverToDcPackageDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo) content.GetValueForProperty("DeliverToDcPackageDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal)this).DeliverToDcPackageDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DeliverToDcPackageDetailCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal)this).DeliverToDcPackageDetailCarrierName = (string) content.GetValueForProperty("DeliverToDcPackageDetailCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal)this).DeliverToDcPackageDetailCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliverToDcPackageDetailTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal)this).DeliverToDcPackageDetailTrackingId = (string) content.GetValueForProperty("DeliverToDcPackageDetailTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal)this).DeliverToDcPackageDetailTrackingId, 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 MarkDevicesShippedRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeliverToDcPackageDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal)this).DeliverToDcPackageDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo) content.GetValueForProperty("DeliverToDcPackageDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal)this).DeliverToDcPackageDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DeliverToDcPackageDetailCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal)this).DeliverToDcPackageDetailCarrierName = (string) content.GetValueForProperty("DeliverToDcPackageDetailCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal)this).DeliverToDcPackageDetailCarrierName, global::System.Convert.ToString); + } + if (content.Contains("DeliverToDcPackageDetailTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal)this).DeliverToDcPackageDetailTrackingId = (string) content.GetValueForProperty("DeliverToDcPackageDetailTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal)this).DeliverToDcPackageDetailTrackingId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 request body to provide the delivery package details of job + [System.ComponentModel.TypeConverter(typeof(MarkDevicesShippedRequestTypeConverter))] + public partial interface IMarkDevicesShippedRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.TypeConverter.cs new file mode 100644 index 00000000000..1c84c0385ef --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MarkDevicesShippedRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MarkDevicesShippedRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MarkDevicesShippedRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MarkDevicesShippedRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.cs new file mode 100644 index 00000000000..dd540451aa6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The request body to provide the delivery package details of job + public partial class MarkDevicesShippedRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo _deliverToDcPackageDetail; + + /// Delivery package details + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo DeliverToDcPackageDetail { get => (this._deliverToDcPackageDetail = this._deliverToDcPackageDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierInfo()); set => this._deliverToDcPackageDetail = value; } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeliverToDcPackageDetailCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)DeliverToDcPackageDetail).CarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)DeliverToDcPackageDetail).CarrierName = value ?? null; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeliverToDcPackageDetailTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)DeliverToDcPackageDetail).TrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)DeliverToDcPackageDetail).TrackingId = value ?? null; } + + /// Internal Acessors for DeliverToDcPackageDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequestInternal.DeliverToDcPackageDetail { get => (this._deliverToDcPackageDetail = this._deliverToDcPackageDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierInfo()); set { {_deliverToDcPackageDetail = value;} } } + + /// Creates an new instance. + public MarkDevicesShippedRequest() + { + + } + } + /// The request body to provide the delivery package details of job + public partial interface IMarkDevicesShippedRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the carrier.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string DeliverToDcPackageDetailCarrierName { get; set; } + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Tracking Id of shipment.", + SerializedName = @"trackingId", + PossibleTypes = new [] { typeof(string) })] + string DeliverToDcPackageDetailTrackingId { get; set; } + + } + /// The request body to provide the delivery package details of job + internal partial interface IMarkDevicesShippedRequestInternal + + { + /// Delivery package details + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo DeliverToDcPackageDetail { get; set; } + /// Name of the carrier. + string DeliverToDcPackageDetailCarrierName { get; set; } + /// Tracking Id of shipment. + string DeliverToDcPackageDetailTrackingId { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.json.cs new file mode 100644 index 00000000000..7d7b1de5583 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MarkDevicesShippedRequest.json.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The request body to provide the delivery package details of job + public partial class MarkDevicesShippedRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new MarkDevicesShippedRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal MarkDevicesShippedRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_deliverToDcPackageDetail = If( json?.PropertyT("deliverToDcPackageDetails"), out var __jsonDeliverToDcPackageDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierInfo.FromJson(__jsonDeliverToDcPackageDetails) : _deliverToDcPackageDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._deliverToDcPackageDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._deliverToDcPackageDetail.ToJson(null,serializationMode) : null, "deliverToDcPackageDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.PowerShell.cs new file mode 100644 index 00000000000..58b1f23122e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The Mitigate Job captured from request body for Mitigate API + [System.ComponentModel.TypeConverter(typeof(MitigateJobRequestTypeConverter))] + public partial class MitigateJobRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MitigateJobRequest(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.DataBox.Models.IMitigateJobRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MitigateJobRequest(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.DataBox.Models.IMitigateJobRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MitigateJobRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomerResolutionCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestInternal)this).CustomerResolutionCode = (string) content.GetValueForProperty("CustomerResolutionCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestInternal)this).CustomerResolutionCode, global::System.Convert.ToString); + } + if (content.Contains("SerialNumberCustomerResolutionMap")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestInternal)this).SerialNumberCustomerResolutionMap = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap) content.GetValueForProperty("SerialNumberCustomerResolutionMap",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestInternal)this).SerialNumberCustomerResolutionMap, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.MitigateJobRequestSerialNumberCustomerResolutionMapTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MitigateJobRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomerResolutionCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestInternal)this).CustomerResolutionCode = (string) content.GetValueForProperty("CustomerResolutionCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestInternal)this).CustomerResolutionCode, global::System.Convert.ToString); + } + if (content.Contains("SerialNumberCustomerResolutionMap")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestInternal)this).SerialNumberCustomerResolutionMap = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap) content.GetValueForProperty("SerialNumberCustomerResolutionMap",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestInternal)this).SerialNumberCustomerResolutionMap, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.MitigateJobRequestSerialNumberCustomerResolutionMapTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Mitigate Job captured from request body for Mitigate API + [System.ComponentModel.TypeConverter(typeof(MitigateJobRequestTypeConverter))] + public partial interface IMitigateJobRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.TypeConverter.cs new file mode 100644 index 00000000000..5e9b434897f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MitigateJobRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MitigateJobRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MitigateJobRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MitigateJobRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.cs new file mode 100644 index 00000000000..7b9fbd533a7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The Mitigate Job captured from request body for Mitigate API + public partial class MitigateJobRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestInternal + { + + /// Backing field for property. + private string _customerResolutionCode; + + /// Resolution code for the job + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CustomerResolutionCode { get => this._customerResolutionCode; set => this._customerResolutionCode = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap _serialNumberCustomerResolutionMap; + + /// + /// Serial number and the customer resolution code corresponding to each serial number + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap SerialNumberCustomerResolutionMap { get => (this._serialNumberCustomerResolutionMap = this._serialNumberCustomerResolutionMap ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.MitigateJobRequestSerialNumberCustomerResolutionMap()); set => this._serialNumberCustomerResolutionMap = value; } + + /// Creates an new instance. + public MitigateJobRequest() + { + + } + } + /// The Mitigate Job captured from request body for Mitigate API + public partial interface IMitigateJobRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Resolution code for the job + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Resolution code for the job", + SerializedName = @"customerResolutionCode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + string CustomerResolutionCode { get; set; } + /// + /// Serial number and the customer resolution code corresponding to each serial number + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Serial number and the customer resolution code corresponding to each serial number", + SerializedName = @"serialNumberCustomerResolutionMap", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap SerialNumberCustomerResolutionMap { get; set; } + + } + /// The Mitigate Job captured from request body for Mitigate API + internal partial interface IMitigateJobRequestInternal + + { + /// Resolution code for the job + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + string CustomerResolutionCode { get; set; } + /// + /// Serial number and the customer resolution code corresponding to each serial number + /// + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap SerialNumberCustomerResolutionMap { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.json.cs new file mode 100644 index 00000000000..1763b159888 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The Mitigate Job captured from request body for Mitigate API + public partial class MitigateJobRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new MitigateJobRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal MitigateJobRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_customerResolutionCode = If( json?.PropertyT("customerResolutionCode"), out var __jsonCustomerResolutionCode) ? (string)__jsonCustomerResolutionCode : (string)_customerResolutionCode;} + {_serialNumberCustomerResolutionMap = If( json?.PropertyT("serialNumberCustomerResolutionMap"), out var __jsonSerialNumberCustomerResolutionMap) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.MitigateJobRequestSerialNumberCustomerResolutionMap.FromJson(__jsonSerialNumberCustomerResolutionMap) : _serialNumberCustomerResolutionMap;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._customerResolutionCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._customerResolutionCode.ToString()) : null, "customerResolutionCode" ,container.Add ); + AddIf( null != this._serialNumberCustomerResolutionMap ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._serialNumberCustomerResolutionMap.ToJson(null,serializationMode) : null, "serialNumberCustomerResolutionMap" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.PowerShell.cs new file mode 100644 index 00000000000..a4402e4c96f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// Serial number and the customer resolution code corresponding to each serial number + /// + [System.ComponentModel.TypeConverter(typeof(MitigateJobRequestSerialNumberCustomerResolutionMapTypeConverter))] + public partial class MitigateJobRequestSerialNumberCustomerResolutionMap + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MitigateJobRequestSerialNumberCustomerResolutionMap(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.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MitigateJobRequestSerialNumberCustomerResolutionMap(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.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MitigateJobRequestSerialNumberCustomerResolutionMap(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MitigateJobRequestSerialNumberCustomerResolutionMap(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Serial number and the customer resolution code corresponding to each serial number + [System.ComponentModel.TypeConverter(typeof(MitigateJobRequestSerialNumberCustomerResolutionMapTypeConverter))] + public partial interface IMitigateJobRequestSerialNumberCustomerResolutionMap + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.TypeConverter.cs new file mode 100644 index 00000000000..c589eeef613 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MitigateJobRequestSerialNumberCustomerResolutionMapTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MitigateJobRequestSerialNumberCustomerResolutionMap.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MitigateJobRequestSerialNumberCustomerResolutionMap.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MitigateJobRequestSerialNumberCustomerResolutionMap.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.cs new file mode 100644 index 00000000000..7ac4baf785d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Serial number and the customer resolution code corresponding to each serial number + /// + public partial class MitigateJobRequestSerialNumberCustomerResolutionMap : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMapInternal + { + + /// + /// Creates an new instance. + /// + public MitigateJobRequestSerialNumberCustomerResolutionMap() + { + + } + } + /// Serial number and the customer resolution code corresponding to each serial number + public partial interface IMitigateJobRequestSerialNumberCustomerResolutionMap : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + + } + /// Serial number and the customer resolution code corresponding to each serial number + internal partial interface IMitigateJobRequestSerialNumberCustomerResolutionMapInternal + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.dictionary.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.dictionary.cs new file mode 100644 index 00000000000..536838a3c98 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.dictionary.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class MitigateJobRequestSerialNumberCustomerResolutionMap : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.MitigateJobRequestSerialNumberCustomerResolutionMap source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.json.cs new file mode 100644 index 00000000000..c136e78b6eb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/MitigateJobRequestSerialNumberCustomerResolutionMap.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Serial number and the customer resolution code corresponding to each serial number + /// + public partial class MitigateJobRequestSerialNumberCustomerResolutionMap + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new MitigateJobRequestSerialNumberCustomerResolutionMap(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + /// + internal MitigateJobRequestSerialNumberCustomerResolutionMap(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.PowerShell.cs new file mode 100644 index 00000000000..340d85ba27e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Notification preference for a job stage. + [System.ComponentModel.TypeConverter(typeof(NotificationPreferenceTypeConverter))] + public partial class NotificationPreference + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreference DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NotificationPreference(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.DataBox.Models.INotificationPreference DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NotificationPreference(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.DataBox.Models.INotificationPreference FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NotificationPreference(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StageName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreferenceInternal)this).StageName = (string) content.GetValueForProperty("StageName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreferenceInternal)this).StageName, global::System.Convert.ToString); + } + if (content.Contains("SendNotification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreferenceInternal)this).SendNotification = (bool) content.GetValueForProperty("SendNotification",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreferenceInternal)this).SendNotification, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NotificationPreference(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StageName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreferenceInternal)this).StageName = (string) content.GetValueForProperty("StageName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreferenceInternal)this).StageName, global::System.Convert.ToString); + } + if (content.Contains("SendNotification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreferenceInternal)this).SendNotification = (bool) content.GetValueForProperty("SendNotification",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreferenceInternal)this).SendNotification, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Notification preference for a job stage. + [System.ComponentModel.TypeConverter(typeof(NotificationPreferenceTypeConverter))] + public partial interface INotificationPreference + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.TypeConverter.cs new file mode 100644 index 00000000000..f1b160e99b0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NotificationPreferenceTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreference ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreference).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NotificationPreference.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NotificationPreference.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NotificationPreference.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.cs new file mode 100644 index 00000000000..70de180088e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Notification preference for a job stage. + public partial class NotificationPreference : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreference, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreferenceInternal + { + + /// Backing field for property. + private bool _sendNotification; + + /// Notification is required or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool SendNotification { get => this._sendNotification; set => this._sendNotification = value; } + + /// Backing field for property. + private string _stageName; + + /// Name of the stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StageName { get => this._stageName; set => this._stageName = value; } + + /// Creates an new instance. + public NotificationPreference() + { + + } + } + /// Notification preference for a job stage. + public partial interface INotificationPreference : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Notification is required or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Notification is required or not.", + SerializedName = @"sendNotification", + PossibleTypes = new [] { typeof(bool) })] + bool SendNotification { get; set; } + /// Name of the stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the stage.", + SerializedName = @"stageName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Created", "ShippedToCustomer")] + string StageName { get; set; } + + } + /// Notification preference for a job stage. + internal partial interface INotificationPreferenceInternal + + { + /// Notification is required or not. + bool SendNotification { get; set; } + /// Name of the stage. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Created", "ShippedToCustomer")] + string StageName { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.json.cs new file mode 100644 index 00000000000..5176adc64d7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/NotificationPreference.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Notification preference for a job stage. + public partial class NotificationPreference + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreference. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreference. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreference FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new NotificationPreference(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal NotificationPreference(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_stageName = If( json?.PropertyT("stageName"), out var __jsonStageName) ? (string)__jsonStageName : (string)_stageName;} + {_sendNotification = If( json?.PropertyT("sendNotification"), out var __jsonSendNotification) ? (bool)__jsonSendNotification : _sendNotification;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._stageName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._stageName.ToString()) : null, "stageName" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean(this._sendNotification), "sendNotification" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.PowerShell.cs new file mode 100644 index 00000000000..cbaee75665c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.PowerShell.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Operation entity. + [System.ComponentModel.TypeConverter(typeof(OperationTypeConverter))] + public partial class Operation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Operation(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.DataBox.Models.IOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Operation(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.DataBox.Models.IOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Operation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Display")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationDisplayTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Origin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Origin, global::System.Convert.ToString); + } + if (content.Contains("IsDataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayDescription, 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 Operation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Display")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationDisplayTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Origin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).Origin, global::System.Convert.ToString); + } + if (content.Contains("IsDataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Operation entity. + [System.ComponentModel.TypeConverter(typeof(OperationTypeConverter))] + public partial interface IOperation + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.TypeConverter.cs new file mode 100644 index 00000000000..f272c653ca9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Operation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Operation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Operation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.cs new file mode 100644 index 00000000000..895fcf30fec --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Operation entity. + public partial class Operation : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperation, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay _display; + + /// Operation display values. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationDisplay()); } + + /// Localized description of the operation for display purpose. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)Display).Description; } + + /// Localized name of the operation for display purpose. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)Display).Operation; } + + /// Provider name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)Display).Provider; } + + /// Resource name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)Display).Resource; } + + /// Backing field for property. + private bool? _isDataAction; + + /// Indicates whether the operation is a data action + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? IsDataAction { get => this._isDataAction; set => this._isDataAction = value; } + + /// Internal Acessors for Display + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationDisplay()); set { {_display = value;} } } + + /// Internal Acessors for DisplayDescription + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal.DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)Display).Description = value ?? null; } + + /// Internal Acessors for DisplayOperation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal.DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)Display).Operation = value ?? null; } + + /// Internal Acessors for DisplayProvider + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal.DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)Display).Provider = value ?? null; } + + /// Internal Acessors for DisplayResource + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal.DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)Display).Resource = value ?? null; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Origin + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal.Origin { get => this._origin; set { {_origin = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationProperties()); set { {_property = value;} } } + + /// Backing field for property. + private string _name; + + /// + /// Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action} + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _origin; + + /// Origin of the operation. Can be : user|system|user,system + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Origin { get => this._origin; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties _property; + + /// Operation properties. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationProperties()); } + + /// Creates an new instance. + public Operation() + { + + } + } + /// Operation entity. + public partial interface IOperation : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Localized description of the operation for display purpose. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Localized description of the operation for display purpose.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string DisplayDescription { get; } + /// Localized name of the operation for display purpose. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Localized name of the operation for display purpose.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string DisplayOperation { get; } + /// Provider name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Provider name.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string DisplayProvider { get; } + /// Resource name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Resource name.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string DisplayResource { get; } + /// Indicates whether the operation is a data action + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates whether the operation is a data action", + SerializedName = @"isDataAction", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDataAction { get; set; } + /// + /// Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action} + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Origin of the operation. Can be : user|system|user,system + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Origin of the operation. Can be : user|system|user,system", + SerializedName = @"origin", + PossibleTypes = new [] { typeof(string) })] + string Origin { get; } + /// Operation properties. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Operation properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties Property { get; } + + } + /// Operation entity. + internal partial interface IOperationInternal + + { + /// Operation display values. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay Display { get; set; } + /// Localized description of the operation for display purpose. + string DisplayDescription { get; set; } + /// Localized name of the operation for display purpose. + string DisplayOperation { get; set; } + /// Provider name. + string DisplayProvider { get; set; } + /// Resource name. + string DisplayResource { get; set; } + /// Indicates whether the operation is a data action + bool? IsDataAction { get; set; } + /// + /// Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action} + /// + string Name { get; set; } + /// Origin of the operation. Can be : user|system|user,system + string Origin { get; set; } + /// Operation properties. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.json.cs new file mode 100644 index 00000000000..d248a2295f4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Operation.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Operation entity. + public partial class Operation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperation. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperation. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new Operation(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal Operation(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationDisplay.FromJson(__jsonDisplay) : _display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationProperties.FromJson(__jsonProperties) : _property;} + {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)_origin;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : _isDataAction;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._origin)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._origin.ToString()) : null, "origin" ,container.Add ); + } + AddIf( null != this._isDataAction ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._isDataAction) : null, "isDataAction" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.PowerShell.cs new file mode 100644 index 00000000000..08d489c23c4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Operation display + [System.ComponentModel.TypeConverter(typeof(OperationDisplayTypeConverter))] + public partial class OperationDisplay + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationDisplay(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.DataBox.Models.IOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationDisplay(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.DataBox.Models.IOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationDisplay(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Description, 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 OperationDisplay(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Operation display + [System.ComponentModel.TypeConverter(typeof(OperationDisplayTypeConverter))] + public partial interface IOperationDisplay + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.TypeConverter.cs new file mode 100644 index 00000000000..57d21587dfb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationDisplayTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationDisplay.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationDisplay.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationDisplay.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.cs new file mode 100644 index 00000000000..71d3c70fb46 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Operation display + public partial class OperationDisplay : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplayInternal + { + + /// Backing field for property. + private string _description; + + /// Localized description of the operation for display purpose. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Description { get => this._description; set => this._description = value; } + + /// Backing field for property. + private string _operation; + + /// Localized name of the operation for display purpose. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Operation { get => this._operation; set => this._operation = value; } + + /// Backing field for property. + private string _provider; + + /// Provider name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Provider { get => this._provider; set => this._provider = value; } + + /// Backing field for property. + private string _resource; + + /// Resource name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Resource { get => this._resource; set => this._resource = value; } + + /// Creates an new instance. + public OperationDisplay() + { + + } + } + /// Operation display + public partial interface IOperationDisplay : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Localized description of the operation for display purpose. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Localized description of the operation for display purpose.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; set; } + /// Localized name of the operation for display purpose. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Localized name of the operation for display purpose.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string Operation { get; set; } + /// Provider name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Provider name.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; set; } + /// Resource name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Resource name.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string Resource { get; set; } + + } + /// Operation display + internal partial interface IOperationDisplayInternal + + { + /// Localized description of the operation for display purpose. + string Description { get; set; } + /// Localized name of the operation for display purpose. + string Operation { get; set; } + /// Provider name. + string Provider { get; set; } + /// Resource name. + string Resource { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.json.cs new file mode 100644 index 00000000000..7298cfcaaef --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationDisplay.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Operation display + public partial class OperationDisplay + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new OperationDisplay(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal OperationDisplay(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + 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;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); + AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); + AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.PowerShell.cs new file mode 100644 index 00000000000..acd358de74a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The paginated list of connected cluster API operations. + [System.ComponentModel.TypeConverter(typeof(OperationListTypeConverter))] + public partial class OperationList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationList(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.DataBox.Models.IOperationList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationList(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.DataBox.Models.IOperationList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationListInternal)this).NextLink, 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 OperationList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.OperationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationListInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 paginated list of connected cluster API operations. + [System.ComponentModel.TypeConverter(typeof(OperationListTypeConverter))] + public partial interface IOperationList + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.TypeConverter.cs new file mode 100644 index 00000000000..b3f54573f75 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationListTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.cs new file mode 100644 index 00000000000..41c6cf6e4fc --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The paginated list of connected cluster API operations. + public partial class OperationList : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationList, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationListInternal + { + + /// Internal Acessors for Value + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationListInternal.Value { get => this._value; set { {_value = value;} } } + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of connected cluster API operations. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// The list of connected cluster API operations. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; } + + /// Creates an new instance. + public OperationList() + { + + } + } + /// The paginated list of connected cluster API operations. + public partial interface IOperationList : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// The link to fetch the next page of connected cluster API operations. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The link to fetch the next page of connected cluster API operations.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of connected cluster API operations. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The list of connected cluster API operations.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperation) })] + System.Collections.Generic.List Value { get; } + + } + /// The paginated list of connected cluster API operations. + internal partial interface IOperationListInternal + + { + /// The link to fetch the next page of connected cluster API operations. + string NextLink { get; set; } + /// The list of connected cluster API operations. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.json.cs new file mode 100644 index 00000000000..1b377a693d2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationList.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The paginated list of connected cluster API operations. + public partial class OperationList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationList FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new OperationList(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal OperationList(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IOperation) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Operation.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.PowerShell.cs new file mode 100644 index 00000000000..8fff07e5cb3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Operation properties. + [System.ComponentModel.TypeConverter(typeof(OperationPropertiesTypeConverter))] + public partial class OperationProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationProperties(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.DataBox.Models.IOperationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationProperties(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.DataBox.Models.IOperationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Operation properties. + [System.ComponentModel.TypeConverter(typeof(OperationPropertiesTypeConverter))] + public partial interface IOperationProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.TypeConverter.cs new file mode 100644 index 00000000000..6a9813cb365 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationPropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.cs new file mode 100644 index 00000000000..594a0d72f2a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Operation properties. + public partial class OperationProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationPropertiesInternal + { + + /// Creates an new instance. + public OperationProperties() + { + + } + } + /// Operation properties. + public partial interface IOperationProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + + } + /// Operation properties. + internal partial interface IOperationPropertiesInternal + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.json.cs new file mode 100644 index 00000000000..90cbfdd7b4d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/OperationProperties.json.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Operation properties. + public partial class OperationProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new OperationProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal OperationProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.PowerShell.cs new file mode 100644 index 00000000000..fac7db41e6e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Package carrier details. + [System.ComponentModel.TypeConverter(typeof(PackageCarrierDetailsTypeConverter))] + public partial class PackageCarrierDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PackageCarrierDetails(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.DataBox.Models.IPackageCarrierDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PackageCarrierDetails(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.DataBox.Models.IPackageCarrierDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PackageCarrierDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CarrierAccountNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)this).CarrierAccountNumber = (System.Security.SecureString) content.GetValueForProperty("CarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)this).CarrierAccountNumber, (object ss) => (System.Security.SecureString)ss); + } + if (content.Contains("CarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)this).CarrierName = (string) content.GetValueForProperty("CarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)this).CarrierName, global::System.Convert.ToString); + } + if (content.Contains("TrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)this).TrackingId = (string) content.GetValueForProperty("TrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)this).TrackingId, 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 PackageCarrierDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CarrierAccountNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)this).CarrierAccountNumber = (System.Security.SecureString) content.GetValueForProperty("CarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)this).CarrierAccountNumber, (object ss) => (System.Security.SecureString)ss); + } + if (content.Contains("CarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)this).CarrierName = (string) content.GetValueForProperty("CarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)this).CarrierName, global::System.Convert.ToString); + } + if (content.Contains("TrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)this).TrackingId = (string) content.GetValueForProperty("TrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)this).TrackingId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Package carrier details. + [System.ComponentModel.TypeConverter(typeof(PackageCarrierDetailsTypeConverter))] + public partial interface IPackageCarrierDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.TypeConverter.cs new file mode 100644 index 00000000000..867e483f932 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PackageCarrierDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PackageCarrierDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PackageCarrierDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PackageCarrierDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.cs new file mode 100644 index 00000000000..e0aa7233c29 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Package carrier details. + public partial class PackageCarrierDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal + { + + /// Backing field for property. + private System.Security.SecureString _carrierAccountNumber; + + /// Carrier Account Number of customer for customer disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Security.SecureString CarrierAccountNumber { get => this._carrierAccountNumber; set => this._carrierAccountNumber = value; } + + /// Backing field for property. + private string _carrierName; + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CarrierName { get => this._carrierName; set => this._carrierName = value; } + + /// Backing field for property. + private string _trackingId; + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string TrackingId { get => this._trackingId; set => this._trackingId = value; } + + /// Creates an new instance. + public PackageCarrierDetails() + { + + } + } + /// Package carrier details. + public partial interface IPackageCarrierDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Carrier Account Number of customer for customer disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Carrier Account Number of customer for customer disk.", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(System.Security.SecureString) })] + System.Security.SecureString CarrierAccountNumber { get; set; } + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the carrier.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string CarrierName { get; set; } + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Tracking Id of shipment.", + SerializedName = @"trackingId", + PossibleTypes = new [] { typeof(string) })] + string TrackingId { get; set; } + + } + /// Package carrier details. + internal partial interface IPackageCarrierDetailsInternal + + { + /// Carrier Account Number of customer for customer disk. + System.Security.SecureString CarrierAccountNumber { get; set; } + /// Name of the carrier. + string CarrierName { get; set; } + /// Tracking Id of shipment. + string TrackingId { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.json.cs new file mode 100644 index 00000000000..9a28a930a0c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Package carrier details. + public partial class PackageCarrierDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new PackageCarrierDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal PackageCarrierDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_carrierAccountNumber = If( json?.PropertyT("carrierAccountNumber"), out var __jsonCarrierAccountNumber) ? new System.Net.NetworkCredential("",(string)__jsonCarrierAccountNumber).SecurePassword : _carrierAccountNumber;} + {_carrierName = If( json?.PropertyT("carrierName"), out var __jsonCarrierName) ? (string)__jsonCarrierName : (string)_carrierName;} + {_trackingId = If( json?.PropertyT("trackingId"), out var __jsonTrackingId) ? (string)__jsonTrackingId : (string)_trackingId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._carrierAccountNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(System.Runtime.InteropServices.Marshal.PtrToStringBSTR(System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this._carrierAccountNumber))) : null, "carrierAccountNumber" ,container.Add ); + AddIf( null != (((object)this._carrierName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._carrierName.ToString()) : null, "carrierName" ,container.Add ); + AddIf( null != (((object)this._trackingId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._trackingId.ToString()) : null, "trackingId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.PowerShell.cs new file mode 100644 index 00000000000..7051d13a1c5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// package carrier info + [System.ComponentModel.TypeConverter(typeof(PackageCarrierInfoTypeConverter))] + public partial class PackageCarrierInfo + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PackageCarrierInfo(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.DataBox.Models.IPackageCarrierInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PackageCarrierInfo(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.DataBox.Models.IPackageCarrierInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PackageCarrierInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)this).CarrierName = (string) content.GetValueForProperty("CarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)this).CarrierName, global::System.Convert.ToString); + } + if (content.Contains("TrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)this).TrackingId = (string) content.GetValueForProperty("TrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)this).TrackingId, 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 PackageCarrierInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)this).CarrierName = (string) content.GetValueForProperty("CarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)this).CarrierName, global::System.Convert.ToString); + } + if (content.Contains("TrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)this).TrackingId = (string) content.GetValueForProperty("TrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal)this).TrackingId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// package carrier info + [System.ComponentModel.TypeConverter(typeof(PackageCarrierInfoTypeConverter))] + public partial interface IPackageCarrierInfo + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.TypeConverter.cs new file mode 100644 index 00000000000..487231782e6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PackageCarrierInfoTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PackageCarrierInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PackageCarrierInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PackageCarrierInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.cs new file mode 100644 index 00000000000..38fe48bde4f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// package carrier info + public partial class PackageCarrierInfo : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfoInternal + { + + /// Backing field for property. + private string _carrierName; + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CarrierName { get => this._carrierName; set => this._carrierName = value; } + + /// Backing field for property. + private string _trackingId; + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string TrackingId { get => this._trackingId; set => this._trackingId = value; } + + /// Creates an new instance. + public PackageCarrierInfo() + { + + } + } + /// package carrier info + public partial interface IPackageCarrierInfo : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the carrier.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string CarrierName { get; set; } + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Tracking Id of shipment.", + SerializedName = @"trackingId", + PossibleTypes = new [] { typeof(string) })] + string TrackingId { get; set; } + + } + /// package carrier info + internal partial interface IPackageCarrierInfoInternal + + { + /// Name of the carrier. + string CarrierName { get; set; } + /// Tracking Id of shipment. + string TrackingId { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.json.cs new file mode 100644 index 00000000000..563e5614393 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageCarrierInfo.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// package carrier info + public partial class PackageCarrierInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new PackageCarrierInfo(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal PackageCarrierInfo(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_carrierName = If( json?.PropertyT("carrierName"), out var __jsonCarrierName) ? (string)__jsonCarrierName : (string)_carrierName;} + {_trackingId = If( json?.PropertyT("trackingId"), out var __jsonTrackingId) ? (string)__jsonTrackingId : (string)_trackingId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._carrierName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._carrierName.ToString()) : null, "carrierName" ,container.Add ); + AddIf( null != (((object)this._trackingId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._trackingId.ToString()) : null, "trackingId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.PowerShell.cs new file mode 100644 index 00000000000..487ce571bab --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// package shipping details + [System.ComponentModel.TypeConverter(typeof(PackageShippingDetailsTypeConverter))] + public partial class PackageShippingDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PackageShippingDetails(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.DataBox.Models.IPackageShippingDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PackageShippingDetails(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.DataBox.Models.IPackageShippingDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PackageShippingDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)this).TrackingUrl = (string) content.GetValueForProperty("TrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)this).TrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("CarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)this).CarrierName = (string) content.GetValueForProperty("CarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)this).CarrierName, global::System.Convert.ToString); + } + if (content.Contains("TrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)this).TrackingId = (string) content.GetValueForProperty("TrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)this).TrackingId, 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 PackageShippingDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TrackingUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)this).TrackingUrl = (string) content.GetValueForProperty("TrackingUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)this).TrackingUrl, global::System.Convert.ToString); + } + if (content.Contains("CarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)this).CarrierName = (string) content.GetValueForProperty("CarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)this).CarrierName, global::System.Convert.ToString); + } + if (content.Contains("TrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)this).TrackingId = (string) content.GetValueForProperty("TrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal)this).TrackingId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// package shipping details + [System.ComponentModel.TypeConverter(typeof(PackageShippingDetailsTypeConverter))] + public partial interface IPackageShippingDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.TypeConverter.cs new file mode 100644 index 00000000000..669af50b45f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PackageShippingDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PackageShippingDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PackageShippingDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PackageShippingDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.cs new file mode 100644 index 00000000000..5ef55bfaff8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// package shipping details + public partial class PackageShippingDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal + { + + /// Backing field for property. + private string _carrierName; + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CarrierName { get => this._carrierName; } + + /// Internal Acessors for CarrierName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal.CarrierName { get => this._carrierName; set { {_carrierName = value;} } } + + /// Internal Acessors for TrackingId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal.TrackingId { get => this._trackingId; set { {_trackingId = value;} } } + + /// Internal Acessors for TrackingUrl + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetailsInternal.TrackingUrl { get => this._trackingUrl; set { {_trackingUrl = value;} } } + + /// Backing field for property. + private string _trackingId; + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string TrackingId { get => this._trackingId; } + + /// Backing field for property. + private string _trackingUrl; + + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string TrackingUrl { get => this._trackingUrl; } + + /// Creates an new instance. + public PackageShippingDetails() + { + + } + } + /// package shipping details + public partial interface IPackageShippingDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the carrier.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string CarrierName { get; } + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Tracking Id of shipment.", + SerializedName = @"trackingId", + PossibleTypes = new [] { typeof(string) })] + string TrackingId { get; } + /// Url where shipment can be tracked. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Url where shipment can be tracked.", + SerializedName = @"trackingUrl", + PossibleTypes = new [] { typeof(string) })] + string TrackingUrl { get; } + + } + /// package shipping details + internal partial interface IPackageShippingDetailsInternal + + { + /// Name of the carrier. + string CarrierName { get; set; } + /// Tracking Id of shipment. + string TrackingId { get; set; } + /// Url where shipment can be tracked. + string TrackingUrl { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.json.cs new file mode 100644 index 00000000000..aafbb0e8b06 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PackageShippingDetails.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// package shipping details + public partial class PackageShippingDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageShippingDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new PackageShippingDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal PackageShippingDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_trackingUrl = If( json?.PropertyT("trackingUrl"), out var __jsonTrackingUrl) ? (string)__jsonTrackingUrl : (string)_trackingUrl;} + {_carrierName = If( json?.PropertyT("carrierName"), out var __jsonCarrierName) ? (string)__jsonCarrierName : (string)_carrierName;} + {_trackingId = If( json?.PropertyT("trackingId"), out var __jsonTrackingId) ? (string)__jsonTrackingId : (string)_trackingId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._trackingUrl)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._trackingUrl.ToString()) : null, "trackingUrl" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._carrierName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._carrierName.ToString()) : null, "carrierName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._trackingId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._trackingId.ToString()) : null, "trackingId" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.PowerShell.cs new file mode 100644 index 00000000000..08122aded3e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.PowerShell.cs @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Preferences related to the order + [System.ComponentModel.TypeConverter(typeof(PreferencesTypeConverter))] + public partial class Preferences + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Preferences(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.DataBox.Models.IPreferences DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Preferences(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.DataBox.Models.IPreferences FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Preferences(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).TransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("TransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).TransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).ReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("ReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).ReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("EncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).EncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("EncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).EncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).PreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).PreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("StorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).StorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("StorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).StorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Preferences(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).TransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("TransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).TransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).ReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("ReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).ReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("EncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).EncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("EncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).EncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).PreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).PreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("StorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).StorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("StorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).StorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Preferences related to the order + [System.ComponentModel.TypeConverter(typeof(PreferencesTypeConverter))] + public partial interface IPreferences + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.TypeConverter.cs new file mode 100644 index 00000000000..ba44a60d452 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PreferencesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Preferences.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Preferences.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Preferences.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.cs new file mode 100644 index 00000000000..5468a0b4c0e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.cs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Preferences related to the order + public partial class Preferences : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences _encryptionPreference; + + /// Preferences related to the Encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences EncryptionPreference { get => (this._encryptionPreference = this._encryptionPreference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferences()); set => this._encryptionPreference = value; } + + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string EncryptionPreferenceDoubleEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal)EncryptionPreference).DoubleEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal)EncryptionPreference).DoubleEncryption = value ?? null; } + + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string EncryptionPreferenceHardwareEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal)EncryptionPreference).HardwareEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferencesInternal)EncryptionPreference).HardwareEncryption = value ?? null; } + + /// Internal Acessors for EncryptionPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal.EncryptionPreference { get => (this._encryptionPreference = this._encryptionPreference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferences()); set { {_encryptionPreference = value;} } } + + /// Internal Acessors for ReverseTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal.ReverseTransportPreference { get => (this._reverseTransportPreference = this._reverseTransportPreference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferences()); set { {_reverseTransportPreference = value;} } } + + /// Internal Acessors for ReverseTransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal.ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)ReverseTransportPreference).IsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)ReverseTransportPreference).IsUpdated = value ?? default(bool); } + + /// Internal Acessors for TransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal.TransportPreference { get => (this._transportPreference = this._transportPreference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferences()); set { {_transportPreference = value;} } } + + /// Internal Acessors for TransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal.TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)TransportPreference).IsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)TransportPreference).IsUpdated = value ?? default(bool); } + + /// Backing field for property. + private System.Collections.Generic.List _preferredDataCenterRegion; + + /// Preferred data center region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List PreferredDataCenterRegion { get => this._preferredDataCenterRegion; set => this._preferredDataCenterRegion = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences _reverseTransportPreference; + + /// Optional Preferences related to the reverse shipment logistics of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences ReverseTransportPreference { get => (this._reverseTransportPreference = this._reverseTransportPreference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferences()); set => this._reverseTransportPreference = value; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)ReverseTransportPreference).IsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseTransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)ReverseTransportPreference).PreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)ReverseTransportPreference).PreferredShipmentType = value ?? null; } + + /// Backing field for property. + private System.Collections.Generic.List _storageAccountAccessTierPreference; + + /// Preferences related to the Access Tier of storage accounts. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List StorageAccountAccessTierPreference { get => this._storageAccountAccessTierPreference; set => this._storageAccountAccessTierPreference = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences _transportPreference; + + /// Preferences related to the shipment logistics of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences TransportPreference { get => (this._transportPreference = this._transportPreference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferences()); set => this._transportPreference = value; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)TransportPreference).IsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)TransportPreference).PreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)TransportPreference).PreferredShipmentType = value ?? null; } + + /// Creates an new instance. + public Preferences() + { + + } + } + /// Preferences related to the order + public partial interface IPreferences : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Defines secondary layer of software-based encryption enablement.", + SerializedName = @"doubleEncryption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceDoubleEncryption { get; set; } + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Defines Hardware level encryption (Only for disk)", + SerializedName = @"hardwareEncryption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceHardwareEncryption { get; set; } + /// Preferred data center region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Preferred data center region.", + SerializedName = @"preferredDataCenterRegion", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List PreferredDataCenterRegion { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? ReverseTransportPreferenceIsUpdated { get; } + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates Shipment Logistics type that the customer preferred.", + SerializedName = @"preferredShipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string ReverseTransportPreferencePreferredShipmentType { get; set; } + /// Preferences related to the Access Tier of storage accounts. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Preferences related to the Access Tier of storage accounts.", + SerializedName = @"storageAccountAccessTierPreferences", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Archive")] + System.Collections.Generic.List StorageAccountAccessTierPreference { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? TransportPreferenceIsUpdated { get; } + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates Shipment Logistics type that the customer preferred.", + SerializedName = @"preferredShipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string TransportPreferencePreferredShipmentType { get; set; } + + } + /// Preferences related to the order + internal partial interface IPreferencesInternal + + { + /// Preferences related to the Encryption. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences EncryptionPreference { get; set; } + /// Defines secondary layer of software-based encryption enablement. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceDoubleEncryption { get; set; } + /// Defines Hardware level encryption (Only for disk) + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceHardwareEncryption { get; set; } + /// Preferred data center region. + System.Collections.Generic.List PreferredDataCenterRegion { get; set; } + /// Optional Preferences related to the reverse shipment logistics of the sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences ReverseTransportPreference { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + bool? ReverseTransportPreferenceIsUpdated { get; set; } + /// Indicates Shipment Logistics type that the customer preferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string ReverseTransportPreferencePreferredShipmentType { get; set; } + /// Preferences related to the Access Tier of storage accounts. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Archive")] + System.Collections.Generic.List StorageAccountAccessTierPreference { get; set; } + /// Preferences related to the shipment logistics of the sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences TransportPreference { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + bool? TransportPreferenceIsUpdated { get; set; } + /// Indicates Shipment Logistics type that the customer preferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string TransportPreferencePreferredShipmentType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.json.cs new file mode 100644 index 00000000000..a13b44bb291 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Preferences.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Preferences related to the order + public partial class Preferences + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new Preferences(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal Preferences(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_transportPreference = If( json?.PropertyT("transportPreferences"), out var __jsonTransportPreferences) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferences.FromJson(__jsonTransportPreferences) : _transportPreference;} + {_reverseTransportPreference = If( json?.PropertyT("reverseTransportPreferences"), out var __jsonReverseTransportPreferences) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferences.FromJson(__jsonReverseTransportPreferences) : _reverseTransportPreference;} + {_encryptionPreference = If( json?.PropertyT("encryptionPreferences"), out var __jsonEncryptionPreferences) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferences.FromJson(__jsonEncryptionPreferences) : _encryptionPreference;} + {_preferredDataCenterRegion = If( json?.PropertyT("preferredDataCenterRegion"), out var __jsonPreferredDataCenterRegion) ? If( __jsonPreferredDataCenterRegion as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _preferredDataCenterRegion;} + {_storageAccountAccessTierPreference = If( json?.PropertyT("storageAccountAccessTierPreferences"), out var __jsonStorageAccountAccessTierPreferences) ? If( __jsonStorageAccountAccessTierPreferences as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : _storageAccountAccessTierPreference;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._transportPreference ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._transportPreference.ToJson(null,serializationMode) : null, "transportPreferences" ,container.Add ); + AddIf( null != this._reverseTransportPreference ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._reverseTransportPreference.ToJson(null,serializationMode) : null, "reverseTransportPreferences" ,container.Add ); + AddIf( null != this._encryptionPreference ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._encryptionPreference.ToJson(null,serializationMode) : null, "encryptionPreferences" ,container.Add ); + if (null != this._preferredDataCenterRegion) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._preferredDataCenterRegion ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("preferredDataCenterRegion",__w); + } + if (null != this._storageAccountAccessTierPreference) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __s in this._storageAccountAccessTierPreference ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("storageAccountAccessTierPreferences",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.PowerShell.cs new file mode 100644 index 00000000000..5bdf8e57369 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.PowerShell.cs @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request to validate preference of transport and data center. + [System.ComponentModel.TypeConverter(typeof(PreferencesValidationRequestTypeConverter))] + public partial class PreferencesValidationRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PreferencesValidationRequest(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.DataBox.Models.IPreferencesValidationRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PreferencesValidationRequest(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.DataBox.Models.IPreferencesValidationRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PreferencesValidationRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).DeviceType = (string) content.GetValueForProperty("DeviceType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).DeviceType, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).Model, global::System.Convert.ToString); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PreferencesValidationRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).DeviceType = (string) content.GetValueForProperty("DeviceType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).DeviceType, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).Model, global::System.Convert.ToString); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Request to validate preference of transport and data center. + [System.ComponentModel.TypeConverter(typeof(PreferencesValidationRequestTypeConverter))] + public partial interface IPreferencesValidationRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.TypeConverter.cs new file mode 100644 index 00000000000..9d89d28988b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PreferencesValidationRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PreferencesValidationRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PreferencesValidationRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PreferencesValidationRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.cs new file mode 100644 index 00000000000..2033a83211b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.cs @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request to validate preference of transport and data center. + public partial class PreferencesValidationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest __validationInputRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest(); + + /// Backing field for property. + private string _deviceType; + + /// Device type to be used for the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DeviceType { get => this._deviceType; set => this._deviceType = value; } + + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string EncryptionPreferenceDoubleEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreferenceDoubleEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreferenceDoubleEncryption = value ?? null; } + + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string EncryptionPreferenceHardwareEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreferenceHardwareEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreferenceHardwareEncryption = value ?? null; } + + /// Internal Acessors for Preference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal.Preference { get => (this._preference = this._preference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Preferences()); set { {_preference = value;} } } + + /// Internal Acessors for PreferenceEncryptionPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal.PreferenceEncryptionPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceReverseTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal.PreferenceReverseTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal.PreferenceTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for ReverseTransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal.ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferenceIsUpdated = value ?? default(bool); } + + /// Internal Acessors for TransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequestInternal.TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferenceIsUpdated = value ?? default(bool); } + + /// Backing field for property. + private string _model; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Model { get => this._model; set => this._model = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences _preference; + + /// Preference of transport and data center. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Preference { get => (this._preference = this._preference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Preferences()); set => this._preference = value; } + + /// Preferred data center region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List PreferencePreferredDataCenterRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).PreferredDataCenterRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).PreferredDataCenterRegion = value ?? null /* arrayOf */; } + + /// Preferences related to the Access Tier of storage accounts. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).StorageAccountAccessTierPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).StorageAccountAccessTierPreference = value ?? null /* arrayOf */; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseTransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferencePreferredShipmentType = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferencePreferredShipmentType = value ?? null; } + + /// Identifies the type of validation request. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationType { get => "ValidatePreferences"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)__validationInputRequest).ValidationType = "ValidatePreferences"; } + + /// Creates an new instance. + public PreferencesValidationRequest() + { + this.__validationInputRequest.ValidationType = "ValidatePreferences"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationInputRequest), __validationInputRequest); + await eventListener.AssertObjectIsValid(nameof(__validationInputRequest), __validationInputRequest); + } + } + /// Request to validate preference of transport and data center. + public partial interface IPreferencesValidationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest + { + /// Device type to be used for the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Device type to be used for the job.", + SerializedName = @"deviceType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DeviceType { get; set; } + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Defines secondary layer of software-based encryption enablement.", + SerializedName = @"doubleEncryption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceDoubleEncryption { get; set; } + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Defines Hardware level encryption (Only for disk)", + SerializedName = @"hardwareEncryption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceHardwareEncryption { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Preferred data center region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Preferred data center region.", + SerializedName = @"preferredDataCenterRegion", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List PreferencePreferredDataCenterRegion { get; set; } + /// Preferences related to the Access Tier of storage accounts. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Preferences related to the Access Tier of storage accounts.", + SerializedName = @"storageAccountAccessTierPreferences", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Archive")] + System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? ReverseTransportPreferenceIsUpdated { get; } + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates Shipment Logistics type that the customer preferred.", + SerializedName = @"preferredShipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string ReverseTransportPreferencePreferredShipmentType { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? TransportPreferenceIsUpdated { get; } + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates Shipment Logistics type that the customer preferred.", + SerializedName = @"preferredShipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string TransportPreferencePreferredShipmentType { get; set; } + + } + /// Request to validate preference of transport and data center. + internal partial interface IPreferencesValidationRequestInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal + { + /// Device type to be used for the job. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DeviceType { get; set; } + /// Defines secondary layer of software-based encryption enablement. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceDoubleEncryption { get; set; } + /// Defines Hardware level encryption (Only for disk) + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceHardwareEncryption { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Preference of transport and data center. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Preference { get; set; } + /// Preferences related to the Encryption. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences PreferenceEncryptionPreference { get; set; } + /// Preferred data center region. + System.Collections.Generic.List PreferencePreferredDataCenterRegion { get; set; } + /// Optional Preferences related to the reverse shipment logistics of the sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceReverseTransportPreference { get; set; } + /// Preferences related to the Access Tier of storage accounts. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Archive")] + System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get; set; } + /// Preferences related to the shipment logistics of the sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceTransportPreference { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + bool? ReverseTransportPreferenceIsUpdated { get; set; } + /// Indicates Shipment Logistics type that the customer preferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string ReverseTransportPreferencePreferredShipmentType { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + bool? TransportPreferenceIsUpdated { get; set; } + /// Indicates Shipment Logistics type that the customer preferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string TransportPreferencePreferredShipmentType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.json.cs new file mode 100644 index 00000000000..ab47116a768 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationRequest.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request to validate preference of transport and data center. + public partial class PreferencesValidationRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new PreferencesValidationRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal PreferencesValidationRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationInputRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest(json); + {_preference = If( json?.PropertyT("preference"), out var __jsonPreference) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Preferences.FromJson(__jsonPreference) : _preference;} + {_deviceType = If( json?.PropertyT("deviceType"), out var __jsonDeviceType) ? (string)__jsonDeviceType : (string)_deviceType;} + {_model = If( json?.PropertyT("model"), out var __jsonModel) ? (string)__jsonModel : (string)_model;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationInputRequest?.ToJson(container, serializationMode); + AddIf( null != this._preference ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._preference.ToJson(null,serializationMode) : null, "preference" ,container.Add ); + AddIf( null != (((object)this._deviceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._deviceType.ToString()) : null, "deviceType" ,container.Add ); + AddIf( null != (((object)this._model)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._model.ToString()) : null, "model" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.PowerShell.cs new file mode 100644 index 00000000000..03a6f912d45 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.PowerShell.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Properties of data center and transport preference validation response. + [System.ComponentModel.TypeConverter(typeof(PreferencesValidationResponsePropertiesTypeConverter))] + public partial class PreferencesValidationResponseProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponseProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PreferencesValidationResponseProperties(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.DataBox.Models.IPreferencesValidationResponseProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PreferencesValidationResponseProperties(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.DataBox.Models.IPreferencesValidationResponseProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PreferencesValidationResponseProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponsePropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponsePropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, 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 PreferencesValidationResponseProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponsePropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponsePropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 data center and transport preference validation response. + [System.ComponentModel.TypeConverter(typeof(PreferencesValidationResponsePropertiesTypeConverter))] + public partial interface IPreferencesValidationResponseProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.TypeConverter.cs new file mode 100644 index 00000000000..6c2b00e61af --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PreferencesValidationResponsePropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponseProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponseProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PreferencesValidationResponseProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PreferencesValidationResponseProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PreferencesValidationResponseProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.cs new file mode 100644 index 00000000000..6ab7c44e8d1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of data center and transport preference validation response. + public partial class PreferencesValidationResponseProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponseProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponsePropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse __validationInputResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse(); + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail; } + + /// Error code and message of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error = value ?? null /* model class */; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message; } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponsePropertiesInternal.Status { get => this._status; set { {_status = value;} } } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error = value ?? null /* model class */; } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target = value ?? null; } + + /// Backing field for property. + private string _status; + + /// Validation status of requested data center and transport. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Status { get => this._status; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target; } + + /// Identifies the type of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationType { get => "ValidatePreferences"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).ValidationType = "ValidatePreferences"; } + + /// Creates an new instance. + public PreferencesValidationResponseProperties() + { + this.__validationInputResponse.ValidationType = "ValidatePreferences"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationInputResponse), __validationInputResponse); + await eventListener.AssertObjectIsValid(nameof(__validationInputResponse), __validationInputResponse); + } + } + /// Properties of data center and transport preference validation response. + public partial interface IPreferencesValidationResponseProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse + { + /// Validation status of requested data center and transport. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Validation status of requested data center and transport.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Skipped")] + string Status { get; } + + } + /// Properties of data center and transport preference validation response. + internal partial interface IPreferencesValidationResponsePropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal + { + /// Validation status of requested data center and transport. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Skipped")] + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.json.cs new file mode 100644 index 00000000000..182ce2ed04f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/PreferencesValidationResponseProperties.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of data center and transport preference validation response. + public partial class PreferencesValidationResponseProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponseProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponseProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationResponseProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new PreferencesValidationResponseProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal PreferencesValidationResponseProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationInputResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse(json); + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationInputResponse?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.PowerShell.cs new file mode 100644 index 00000000000..28ac4ec27c2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.PowerShell.cs @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request body to get the configuration for the region. + [System.ComponentModel.TypeConverter(typeof(RegionConfigurationRequestTypeConverter))] + public partial class RegionConfigurationRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RegionConfigurationRequest(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.DataBox.Models.IRegionConfigurationRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RegionConfigurationRequest(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.DataBox.Models.IRegionConfigurationRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RegionConfigurationRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ScheduleAvailabilityRequest")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequest = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest) content.GetValueForProperty("ScheduleAvailabilityRequest",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequest, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityRequestTypeConverter.ConvertFrom); + } + if (content.Contains("TransportAvailabilityRequest")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).TransportAvailabilityRequest = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest) content.GetValueForProperty("TransportAvailabilityRequest",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).TransportAvailabilityRequest, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityRequestTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddressRequest")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequest = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequest) content.GetValueForProperty("DatacenterAddressRequest",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequest, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressRequestTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceCapabilityRequest")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DeviceCapabilityRequest = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest) content.GetValueForProperty("DeviceCapabilityRequest",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DeviceCapabilityRequest, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityRequestTypeConverter.ConvertFrom); + } + if (content.Contains("ScheduleAvailabilityRequestSkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestSkuName = (string) content.GetValueForProperty("ScheduleAvailabilityRequestSkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestSkuName, global::System.Convert.ToString); + } + if (content.Contains("TransportAvailabilityRequestSkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).TransportAvailabilityRequestSkuName = (string) content.GetValueForProperty("TransportAvailabilityRequestSkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).TransportAvailabilityRequestSkuName, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressRequestSkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequestSkuName = (string) content.GetValueForProperty("DatacenterAddressRequestSkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequestSkuName, global::System.Convert.ToString); + } + if (content.Contains("DeviceCapabilityRequestSkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DeviceCapabilityRequestSkuName = (string) content.GetValueForProperty("DeviceCapabilityRequestSkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DeviceCapabilityRequestSkuName, global::System.Convert.ToString); + } + if (content.Contains("ScheduleAvailabilityRequestStorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestStorageLocation = (string) content.GetValueForProperty("ScheduleAvailabilityRequestStorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestStorageLocation, global::System.Convert.ToString); + } + if (content.Contains("ScheduleAvailabilityRequestCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestCountry = (string) content.GetValueForProperty("ScheduleAvailabilityRequestCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestCountry, global::System.Convert.ToString); + } + if (content.Contains("ScheduleAvailabilityRequestModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestModel = (string) content.GetValueForProperty("ScheduleAvailabilityRequestModel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestModel, global::System.Convert.ToString); + } + if (content.Contains("TransportAvailabilityRequestModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).TransportAvailabilityRequestModel = (string) content.GetValueForProperty("TransportAvailabilityRequestModel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).TransportAvailabilityRequestModel, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressRequestStorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequestStorageLocation = (string) content.GetValueForProperty("DatacenterAddressRequestStorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequestStorageLocation, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressRequestModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequestModel = (string) content.GetValueForProperty("DatacenterAddressRequestModel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequestModel, global::System.Convert.ToString); + } + if (content.Contains("DeviceCapabilityRequestModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DeviceCapabilityRequestModel = (string) content.GetValueForProperty("DeviceCapabilityRequestModel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DeviceCapabilityRequestModel, 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 RegionConfigurationRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ScheduleAvailabilityRequest")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequest = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest) content.GetValueForProperty("ScheduleAvailabilityRequest",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequest, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityRequestTypeConverter.ConvertFrom); + } + if (content.Contains("TransportAvailabilityRequest")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).TransportAvailabilityRequest = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest) content.GetValueForProperty("TransportAvailabilityRequest",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).TransportAvailabilityRequest, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityRequestTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddressRequest")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequest = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequest) content.GetValueForProperty("DatacenterAddressRequest",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequest, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressRequestTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceCapabilityRequest")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DeviceCapabilityRequest = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest) content.GetValueForProperty("DeviceCapabilityRequest",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DeviceCapabilityRequest, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityRequestTypeConverter.ConvertFrom); + } + if (content.Contains("ScheduleAvailabilityRequestSkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestSkuName = (string) content.GetValueForProperty("ScheduleAvailabilityRequestSkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestSkuName, global::System.Convert.ToString); + } + if (content.Contains("TransportAvailabilityRequestSkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).TransportAvailabilityRequestSkuName = (string) content.GetValueForProperty("TransportAvailabilityRequestSkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).TransportAvailabilityRequestSkuName, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressRequestSkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequestSkuName = (string) content.GetValueForProperty("DatacenterAddressRequestSkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequestSkuName, global::System.Convert.ToString); + } + if (content.Contains("DeviceCapabilityRequestSkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DeviceCapabilityRequestSkuName = (string) content.GetValueForProperty("DeviceCapabilityRequestSkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DeviceCapabilityRequestSkuName, global::System.Convert.ToString); + } + if (content.Contains("ScheduleAvailabilityRequestStorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestStorageLocation = (string) content.GetValueForProperty("ScheduleAvailabilityRequestStorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestStorageLocation, global::System.Convert.ToString); + } + if (content.Contains("ScheduleAvailabilityRequestCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestCountry = (string) content.GetValueForProperty("ScheduleAvailabilityRequestCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestCountry, global::System.Convert.ToString); + } + if (content.Contains("ScheduleAvailabilityRequestModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestModel = (string) content.GetValueForProperty("ScheduleAvailabilityRequestModel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).ScheduleAvailabilityRequestModel, global::System.Convert.ToString); + } + if (content.Contains("TransportAvailabilityRequestModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).TransportAvailabilityRequestModel = (string) content.GetValueForProperty("TransportAvailabilityRequestModel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).TransportAvailabilityRequestModel, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressRequestStorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequestStorageLocation = (string) content.GetValueForProperty("DatacenterAddressRequestStorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequestStorageLocation, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressRequestModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequestModel = (string) content.GetValueForProperty("DatacenterAddressRequestModel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DatacenterAddressRequestModel, global::System.Convert.ToString); + } + if (content.Contains("DeviceCapabilityRequestModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DeviceCapabilityRequestModel = (string) content.GetValueForProperty("DeviceCapabilityRequestModel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal)this).DeviceCapabilityRequestModel, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Request body to get the configuration for the region. + [System.ComponentModel.TypeConverter(typeof(RegionConfigurationRequestTypeConverter))] + public partial interface IRegionConfigurationRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.TypeConverter.cs new file mode 100644 index 00000000000..c68c6e52bf4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RegionConfigurationRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RegionConfigurationRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RegionConfigurationRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RegionConfigurationRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.cs new file mode 100644 index 00000000000..25a99acc7bf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.cs @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the configuration for the region. + public partial class RegionConfigurationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequest _datacenterAddressRequest; + + /// Request body to get the datacenter address for given sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequest DatacenterAddressRequest { get => (this._datacenterAddressRequest = this._datacenterAddressRequest ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressRequest()); set => this._datacenterAddressRequest = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DatacenterAddressRequestModel { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)DatacenterAddressRequest).Model; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)DatacenterAddressRequest).Model = value ?? null; } + + /// Sku Name for which the data center address requested. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DatacenterAddressRequestSkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)DatacenterAddressRequest).SkuName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)DatacenterAddressRequest).SkuName = value ?? null; } + + /// + /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DatacenterAddressRequestStorageLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)DatacenterAddressRequest).StorageLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequestInternal)DatacenterAddressRequest).StorageLocation = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest _deviceCapabilityRequest; + + /// Request body to get the device capabilities for a given sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest DeviceCapabilityRequest { get => (this._deviceCapabilityRequest = this._deviceCapabilityRequest ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityRequest()); set => this._deviceCapabilityRequest = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeviceCapabilityRequestModel { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal)DeviceCapabilityRequest).Model; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal)DeviceCapabilityRequest).Model = value ?? null; } + + /// Type of the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DeviceCapabilityRequestSkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal)DeviceCapabilityRequest).SkuName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequestInternal)DeviceCapabilityRequest).SkuName = value ?? null; } + + /// Internal Acessors for DatacenterAddressRequest + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequest Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal.DatacenterAddressRequest { get => (this._datacenterAddressRequest = this._datacenterAddressRequest ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressRequest()); set { {_datacenterAddressRequest = value;} } } + + /// Internal Acessors for DeviceCapabilityRequest + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal.DeviceCapabilityRequest { get => (this._deviceCapabilityRequest = this._deviceCapabilityRequest ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityRequest()); set { {_deviceCapabilityRequest = value;} } } + + /// Internal Acessors for ScheduleAvailabilityRequest + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal.ScheduleAvailabilityRequest { get => (this._scheduleAvailabilityRequest = this._scheduleAvailabilityRequest ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityRequest()); set { {_scheduleAvailabilityRequest = value;} } } + + /// Internal Acessors for TransportAvailabilityRequest + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequestInternal.TransportAvailabilityRequest { get => (this._transportAvailabilityRequest = this._transportAvailabilityRequest ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityRequest()); set { {_transportAvailabilityRequest = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest _scheduleAvailabilityRequest; + + /// Request body to get the availability for scheduling orders. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest ScheduleAvailabilityRequest { get => (this._scheduleAvailabilityRequest = this._scheduleAvailabilityRequest ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityRequest()); set => this._scheduleAvailabilityRequest = value; } + + /// Country in which storage location should be supported. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ScheduleAvailabilityRequestCountry { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)ScheduleAvailabilityRequest).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)ScheduleAvailabilityRequest).Country = value ?? null; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ScheduleAvailabilityRequestModel { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)ScheduleAvailabilityRequest).Model; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)ScheduleAvailabilityRequest).Model = value ?? null; } + + /// Sku Name for which the order is to be scheduled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ScheduleAvailabilityRequestSkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)ScheduleAvailabilityRequest).SkuName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)ScheduleAvailabilityRequest).SkuName = value ?? null; } + + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ScheduleAvailabilityRequestStorageLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)ScheduleAvailabilityRequest).StorageLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)ScheduleAvailabilityRequest).StorageLocation = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest _transportAvailabilityRequest; + + /// Request body to get the transport availability for given sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest TransportAvailabilityRequest { get => (this._transportAvailabilityRequest = this._transportAvailabilityRequest ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityRequest()); set => this._transportAvailabilityRequest = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransportAvailabilityRequestModel { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal)TransportAvailabilityRequest).Model; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal)TransportAvailabilityRequest).Model = value ?? null; } + + /// Type of the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransportAvailabilityRequestSkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal)TransportAvailabilityRequest).SkuName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal)TransportAvailabilityRequest).SkuName = value ?? null; } + + /// Creates an new instance. + public RegionConfigurationRequest() + { + + } + } + /// Request body to get the configuration for the region. + public partial interface IRegionConfigurationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string DatacenterAddressRequestModel { get; set; } + /// Sku Name for which the data center address requested. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Sku Name for which the data center address requested.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DatacenterAddressRequestSkuName { get; set; } + /// + /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"storageLocation", + PossibleTypes = new [] { typeof(string) })] + string DatacenterAddressRequestStorageLocation { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string DeviceCapabilityRequestModel { get; set; } + /// Type of the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the device.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DeviceCapabilityRequestSkuName { get; set; } + /// Country in which storage location should be supported. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Country in which storage location should be supported.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string ScheduleAvailabilityRequestCountry { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string ScheduleAvailabilityRequestModel { get; set; } + /// Sku Name for which the order is to be scheduled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Sku Name for which the order is to be scheduled.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string ScheduleAvailabilityRequestSkuName { get; set; } + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"storageLocation", + PossibleTypes = new [] { typeof(string) })] + string ScheduleAvailabilityRequestStorageLocation { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string TransportAvailabilityRequestModel { get; set; } + /// Type of the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the device.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string TransportAvailabilityRequestSkuName { get; set; } + + } + /// Request body to get the configuration for the region. + internal partial interface IRegionConfigurationRequestInternal + + { + /// Request body to get the datacenter address for given sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressRequest DatacenterAddressRequest { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string DatacenterAddressRequestModel { get; set; } + /// Sku Name for which the data center address requested. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DatacenterAddressRequestSkuName { get; set; } + /// + /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + string DatacenterAddressRequestStorageLocation { get; set; } + /// Request body to get the device capabilities for a given sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityRequest DeviceCapabilityRequest { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string DeviceCapabilityRequestModel { get; set; } + /// Type of the device. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DeviceCapabilityRequestSkuName { get; set; } + /// Request body to get the availability for scheduling orders. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest ScheduleAvailabilityRequest { get; set; } + /// Country in which storage location should be supported. + string ScheduleAvailabilityRequestCountry { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string ScheduleAvailabilityRequestModel { get; set; } + /// Sku Name for which the order is to be scheduled. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string ScheduleAvailabilityRequestSkuName { get; set; } + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + string ScheduleAvailabilityRequestStorageLocation { get; set; } + /// Request body to get the transport availability for given sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest TransportAvailabilityRequest { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string TransportAvailabilityRequestModel { get; set; } + /// Type of the device. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string TransportAvailabilityRequestSkuName { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.json.cs new file mode 100644 index 00000000000..c7088106adb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationRequest.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the configuration for the region. + public partial class RegionConfigurationRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new RegionConfigurationRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal RegionConfigurationRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_scheduleAvailabilityRequest = If( json?.PropertyT("scheduleAvailabilityRequest"), out var __jsonScheduleAvailabilityRequest) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityRequest.FromJson(__jsonScheduleAvailabilityRequest) : _scheduleAvailabilityRequest;} + {_transportAvailabilityRequest = If( json?.PropertyT("transportAvailabilityRequest"), out var __jsonTransportAvailabilityRequest) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityRequest.FromJson(__jsonTransportAvailabilityRequest) : _transportAvailabilityRequest;} + {_datacenterAddressRequest = If( json?.PropertyT("datacenterAddressRequest"), out var __jsonDatacenterAddressRequest) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressRequest.FromJson(__jsonDatacenterAddressRequest) : _datacenterAddressRequest;} + {_deviceCapabilityRequest = If( json?.PropertyT("deviceCapabilityRequest"), out var __jsonDeviceCapabilityRequest) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityRequest.FromJson(__jsonDeviceCapabilityRequest) : _deviceCapabilityRequest;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._scheduleAvailabilityRequest ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._scheduleAvailabilityRequest.ToJson(null,serializationMode) : null, "scheduleAvailabilityRequest" ,container.Add ); + AddIf( null != this._transportAvailabilityRequest ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._transportAvailabilityRequest.ToJson(null,serializationMode) : null, "transportAvailabilityRequest" ,container.Add ); + AddIf( null != this._datacenterAddressRequest ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._datacenterAddressRequest.ToJson(null,serializationMode) : null, "datacenterAddressRequest" ,container.Add ); + AddIf( null != this._deviceCapabilityRequest ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._deviceCapabilityRequest.ToJson(null,serializationMode) : null, "deviceCapabilityRequest" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.PowerShell.cs new file mode 100644 index 00000000000..f36805cb69b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.PowerShell.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Configuration response specific to a region. + [System.ComponentModel.TypeConverter(typeof(RegionConfigurationResponseTypeConverter))] + public partial class RegionConfigurationResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RegionConfigurationResponse(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.DataBox.Models.IRegionConfigurationResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RegionConfigurationResponse(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.DataBox.Models.IRegionConfigurationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RegionConfigurationResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ScheduleAvailabilityResponse")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).ScheduleAvailabilityResponse = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse) content.GetValueForProperty("ScheduleAvailabilityResponse",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).ScheduleAvailabilityResponse, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityResponseTypeConverter.ConvertFrom); + } + if (content.Contains("TransportAvailabilityResponse")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).TransportAvailabilityResponse = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse) content.GetValueForProperty("TransportAvailabilityResponse",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).TransportAvailabilityResponse, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityResponseTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddressResponse")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponse = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse) content.GetValueForProperty("DatacenterAddressResponse",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponse, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponseTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceCapabilityResponse")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DeviceCapabilityResponse = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse) content.GetValueForProperty("DeviceCapabilityResponse",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DeviceCapabilityResponse, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityResponseTypeConverter.ConvertFrom); + } + if (content.Contains("ScheduleAvailabilityResponseAvailableDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).ScheduleAvailabilityResponseAvailableDate = (System.Collections.Generic.List) content.GetValueForProperty("ScheduleAvailabilityResponseAvailableDate",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).ScheduleAvailabilityResponseAvailableDate, __y => TypeConverterExtensions.SelectToList(__y, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified))); + } + if (content.Contains("TransportAvailabilityResponseTransportAvailabilityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).TransportAvailabilityResponseTransportAvailabilityDetail = (System.Collections.Generic.List) content.GetValueForProperty("TransportAvailabilityResponseTransportAvailabilityDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).TransportAvailabilityResponseTransportAvailabilityDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DatacenterAddressResponseDatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponseDatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressResponseDatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponseDatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressResponseSupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponseSupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("DatacenterAddressResponseSupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponseSupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DatacenterAddressResponseDataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponseDataCenterAzureLocation = (string) content.GetValueForProperty("DatacenterAddressResponseDataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponseDataCenterAzureLocation, global::System.Convert.ToString); + } + if (content.Contains("DeviceCapabilityResponseDeviceCapabilityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DeviceCapabilityResponseDeviceCapabilityDetail = (System.Collections.Generic.List) content.GetValueForProperty("DeviceCapabilityResponseDeviceCapabilityDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DeviceCapabilityResponseDeviceCapabilityDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RegionConfigurationResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ScheduleAvailabilityResponse")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).ScheduleAvailabilityResponse = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse) content.GetValueForProperty("ScheduleAvailabilityResponse",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).ScheduleAvailabilityResponse, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityResponseTypeConverter.ConvertFrom); + } + if (content.Contains("TransportAvailabilityResponse")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).TransportAvailabilityResponse = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse) content.GetValueForProperty("TransportAvailabilityResponse",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).TransportAvailabilityResponse, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityResponseTypeConverter.ConvertFrom); + } + if (content.Contains("DatacenterAddressResponse")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponse = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse) content.GetValueForProperty("DatacenterAddressResponse",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponse, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponseTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceCapabilityResponse")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DeviceCapabilityResponse = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse) content.GetValueForProperty("DeviceCapabilityResponse",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DeviceCapabilityResponse, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityResponseTypeConverter.ConvertFrom); + } + if (content.Contains("ScheduleAvailabilityResponseAvailableDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).ScheduleAvailabilityResponseAvailableDate = (System.Collections.Generic.List) content.GetValueForProperty("ScheduleAvailabilityResponseAvailableDate",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).ScheduleAvailabilityResponseAvailableDate, __y => TypeConverterExtensions.SelectToList(__y, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified))); + } + if (content.Contains("TransportAvailabilityResponseTransportAvailabilityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).TransportAvailabilityResponseTransportAvailabilityDetail = (System.Collections.Generic.List) content.GetValueForProperty("TransportAvailabilityResponseTransportAvailabilityDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).TransportAvailabilityResponseTransportAvailabilityDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DatacenterAddressResponseDatacenterAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponseDatacenterAddressType = (string) content.GetValueForProperty("DatacenterAddressResponseDatacenterAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponseDatacenterAddressType, global::System.Convert.ToString); + } + if (content.Contains("DatacenterAddressResponseSupportedCarriersForReturnShipment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponseSupportedCarriersForReturnShipment = (System.Collections.Generic.List) content.GetValueForProperty("DatacenterAddressResponseSupportedCarriersForReturnShipment",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponseSupportedCarriersForReturnShipment, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DatacenterAddressResponseDataCenterAzureLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponseDataCenterAzureLocation = (string) content.GetValueForProperty("DatacenterAddressResponseDataCenterAzureLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DatacenterAddressResponseDataCenterAzureLocation, global::System.Convert.ToString); + } + if (content.Contains("DeviceCapabilityResponseDeviceCapabilityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DeviceCapabilityResponseDeviceCapabilityDetail = (System.Collections.Generic.List) content.GetValueForProperty("DeviceCapabilityResponseDeviceCapabilityDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal)this).DeviceCapabilityResponseDeviceCapabilityDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Configuration response specific to a region. + [System.ComponentModel.TypeConverter(typeof(RegionConfigurationResponseTypeConverter))] + public partial interface IRegionConfigurationResponse + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.TypeConverter.cs new file mode 100644 index 00000000000..07e81080d98 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RegionConfigurationResponseTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RegionConfigurationResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RegionConfigurationResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RegionConfigurationResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.cs new file mode 100644 index 00000000000..35bdbbe29f2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Configuration response specific to a region. + public partial class RegionConfigurationResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse _datacenterAddressResponse; + + /// Datacenter address for given sku in a region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse DatacenterAddressResponse { get => (this._datacenterAddressResponse = this._datacenterAddressResponse ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponse()); } + + /// Azure Location where the Data Center serves primarily. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DatacenterAddressResponseDataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddressResponse).DataCenterAzureLocation; } + + /// Data center address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DatacenterAddressResponseDatacenterAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddressResponse).DatacenterAddressType; } + + /// List of supported carriers for return shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List DatacenterAddressResponseSupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddressResponse).SupportedCarriersForReturnShipment; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse _deviceCapabilityResponse; + + /// Device capabilities available for a given sku in a region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse DeviceCapabilityResponse { get => (this._deviceCapabilityResponse = this._deviceCapabilityResponse ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityResponse()); } + + /// List of device capabilities available for a given region and a given sku + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List DeviceCapabilityResponseDeviceCapabilityDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponseInternal)DeviceCapabilityResponse).DeviceCapabilityDetail; } + + /// Internal Acessors for DatacenterAddressResponse + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal.DatacenterAddressResponse { get => (this._datacenterAddressResponse = this._datacenterAddressResponse ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponse()); set { {_datacenterAddressResponse = value;} } } + + /// Internal Acessors for DatacenterAddressResponseDataCenterAzureLocation + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal.DatacenterAddressResponseDataCenterAzureLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddressResponse).DataCenterAzureLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddressResponse).DataCenterAzureLocation = value ?? null; } + + /// Internal Acessors for DatacenterAddressResponseDatacenterAddressType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal.DatacenterAddressResponseDatacenterAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddressResponse).DatacenterAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddressResponse).DatacenterAddressType = value ?? null; } + + /// + /// Internal Acessors for DatacenterAddressResponseSupportedCarriersForReturnShipment + /// + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal.DatacenterAddressResponseSupportedCarriersForReturnShipment { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddressResponse).SupportedCarriersForReturnShipment; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponseInternal)DatacenterAddressResponse).SupportedCarriersForReturnShipment = value ?? null /* arrayOf */; } + + /// Internal Acessors for DeviceCapabilityResponse + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal.DeviceCapabilityResponse { get => (this._deviceCapabilityResponse = this._deviceCapabilityResponse ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityResponse()); set { {_deviceCapabilityResponse = value;} } } + + /// Internal Acessors for DeviceCapabilityResponseDeviceCapabilityDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal.DeviceCapabilityResponseDeviceCapabilityDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponseInternal)DeviceCapabilityResponse).DeviceCapabilityDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponseInternal)DeviceCapabilityResponse).DeviceCapabilityDetail = value ?? null /* arrayOf */; } + + /// Internal Acessors for ScheduleAvailabilityResponse + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal.ScheduleAvailabilityResponse { get => (this._scheduleAvailabilityResponse = this._scheduleAvailabilityResponse ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityResponse()); set { {_scheduleAvailabilityResponse = value;} } } + + /// Internal Acessors for ScheduleAvailabilityResponseAvailableDate + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal.ScheduleAvailabilityResponseAvailableDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponseInternal)ScheduleAvailabilityResponse).AvailableDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponseInternal)ScheduleAvailabilityResponse).AvailableDate = value ?? null /* arrayOf */; } + + /// Internal Acessors for TransportAvailabilityResponse + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal.TransportAvailabilityResponse { get => (this._transportAvailabilityResponse = this._transportAvailabilityResponse ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityResponse()); set { {_transportAvailabilityResponse = value;} } } + + /// Internal Acessors for TransportAvailabilityResponseTransportAvailabilityDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponseInternal.TransportAvailabilityResponseTransportAvailabilityDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponseInternal)TransportAvailabilityResponse).TransportAvailabilityDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponseInternal)TransportAvailabilityResponse).TransportAvailabilityDetail = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse _scheduleAvailabilityResponse; + + /// Schedule availability for given sku in a region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse ScheduleAvailabilityResponse { get => (this._scheduleAvailabilityResponse = this._scheduleAvailabilityResponse ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityResponse()); } + + /// List of dates available to schedule + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List ScheduleAvailabilityResponseAvailableDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponseInternal)ScheduleAvailabilityResponse).AvailableDate; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse _transportAvailabilityResponse; + + /// Transport options available for given sku in a region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse TransportAvailabilityResponse { get => (this._transportAvailabilityResponse = this._transportAvailabilityResponse ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityResponse()); } + + /// List of transport availability details for given region + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List TransportAvailabilityResponseTransportAvailabilityDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponseInternal)TransportAvailabilityResponse).TransportAvailabilityDetail; } + + /// Creates an new instance. + public RegionConfigurationResponse() + { + + } + } + /// Configuration response specific to a region. + public partial interface IRegionConfigurationResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Azure Location where the Data Center serves primarily. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Azure Location where the Data Center serves primarily.", + SerializedName = @"dataCenterAzureLocation", + PossibleTypes = new [] { typeof(string) })] + string DatacenterAddressResponseDataCenterAzureLocation { get; } + /// Data center address type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Data center address type", + SerializedName = @"datacenterAddressType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DatacenterAddressLocation", "DatacenterAddressInstruction")] + string DatacenterAddressResponseDatacenterAddressType { get; } + /// List of supported carriers for return shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of supported carriers for return shipment.", + SerializedName = @"supportedCarriersForReturnShipment", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List DatacenterAddressResponseSupportedCarriersForReturnShipment { get; } + /// List of device capabilities available for a given region and a given sku + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of device capabilities available for a given region and a given sku", + SerializedName = @"deviceCapabilityDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityDetails) })] + System.Collections.Generic.List DeviceCapabilityResponseDeviceCapabilityDetail { get; } + /// List of dates available to schedule + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of dates available to schedule", + SerializedName = @"availableDates", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + System.Collections.Generic.List ScheduleAvailabilityResponseAvailableDate { get; } + /// List of transport availability details for given region + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of transport availability details for given region", + SerializedName = @"transportAvailabilityDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetails) })] + System.Collections.Generic.List TransportAvailabilityResponseTransportAvailabilityDetail { get; } + + } + /// Configuration response specific to a region. + internal partial interface IRegionConfigurationResponseInternal + + { + /// Datacenter address for given sku in a region. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDatacenterAddressResponse DatacenterAddressResponse { get; set; } + /// Azure Location where the Data Center serves primarily. + string DatacenterAddressResponseDataCenterAzureLocation { get; set; } + /// Data center address type + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DatacenterAddressLocation", "DatacenterAddressInstruction")] + string DatacenterAddressResponseDatacenterAddressType { get; set; } + /// List of supported carriers for return shipment. + System.Collections.Generic.List DatacenterAddressResponseSupportedCarriersForReturnShipment { get; set; } + /// Device capabilities available for a given sku in a region. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDeviceCapabilityResponse DeviceCapabilityResponse { get; set; } + /// List of device capabilities available for a given region and a given sku + System.Collections.Generic.List DeviceCapabilityResponseDeviceCapabilityDetail { get; set; } + /// Schedule availability for given sku in a region. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse ScheduleAvailabilityResponse { get; set; } + /// List of dates available to schedule + System.Collections.Generic.List ScheduleAvailabilityResponseAvailableDate { get; set; } + /// Transport options available for given sku in a region. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse TransportAvailabilityResponse { get; set; } + /// List of transport availability details for given region + System.Collections.Generic.List TransportAvailabilityResponseTransportAvailabilityDetail { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.json.cs new file mode 100644 index 00000000000..b44075d5c28 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/RegionConfigurationResponse.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Configuration response specific to a region. + public partial class RegionConfigurationResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new RegionConfigurationResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal RegionConfigurationResponse(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_scheduleAvailabilityResponse = If( json?.PropertyT("scheduleAvailabilityResponse"), out var __jsonScheduleAvailabilityResponse) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ScheduleAvailabilityResponse.FromJson(__jsonScheduleAvailabilityResponse) : _scheduleAvailabilityResponse;} + {_transportAvailabilityResponse = If( json?.PropertyT("transportAvailabilityResponse"), out var __jsonTransportAvailabilityResponse) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityResponse.FromJson(__jsonTransportAvailabilityResponse) : _transportAvailabilityResponse;} + {_datacenterAddressResponse = If( json?.PropertyT("datacenterAddressResponse"), out var __jsonDatacenterAddressResponse) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DatacenterAddressResponse.FromJson(__jsonDatacenterAddressResponse) : _datacenterAddressResponse;} + {_deviceCapabilityResponse = If( json?.PropertyT("deviceCapabilityResponse"), out var __jsonDeviceCapabilityResponse) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DeviceCapabilityResponse.FromJson(__jsonDeviceCapabilityResponse) : _deviceCapabilityResponse;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._scheduleAvailabilityResponse ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._scheduleAvailabilityResponse.ToJson(null,serializationMode) : null, "scheduleAvailabilityResponse" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._transportAvailabilityResponse ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._transportAvailabilityResponse.ToJson(null,serializationMode) : null, "transportAvailabilityResponse" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._datacenterAddressResponse ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._datacenterAddressResponse.ToJson(null,serializationMode) : null, "datacenterAddressResponse" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._deviceCapabilityResponse ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._deviceCapabilityResponse.ToJson(null,serializationMode) : null, "deviceCapabilityResponse" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.PowerShell.cs new file mode 100644 index 00000000000..aab51d44f92 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.PowerShell.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// Common fields that are returned in the response for all Azure Resource Manager resources + /// + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial class Resource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Resource(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.DataBox.Models.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Resource(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.DataBox.Models.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Resource(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.DataBox.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Resource(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.DataBox.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Common fields that are returned in the response for all Azure Resource Manager resources + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial interface IResource + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.TypeConverter.cs new file mode 100644 index 00000000000..064ad89d799 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Resource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Resource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Resource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.cs new file mode 100644 index 00000000000..c9e9d91379d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Common fields that are returned in the response for all Azure Resource Manager resources + /// + public partial class Resource : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResource, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal + { + + /// Backing field for property. + private string _id; + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for SystemDataCreatedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Internal Acessors for SystemDataCreatedBy + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + + /// Internal Acessors for SystemDataCreatedByType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).CreatedByType = value ?? null; } + + /// Internal Acessors for SystemDataLastModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Internal Acessors for SystemDataLastModifiedBy + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + + /// Internal Acessors for SystemDataLastModifiedByType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData _systemData; + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SystemData()); } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).CreatedAt; } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).CreatedBy; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).CreatedByType; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).LastModifiedAt; } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).LastModifiedBy; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)SystemData).LastModifiedByType; } + + /// Backing field for property. + private string _type; + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public Resource() + { + + } + } + /// Common fields that are returned in the response for all Azure Resource Manager resources + public partial interface IResource : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The name of the resource", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of the resource. E.g. ""Microsoft.Compute/virtualMachines"" or ""Microsoft.Storage/storageAccounts""", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Common fields that are returned in the response for all Azure Resource Manager resources + internal partial interface IResourceInternal + + { + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + string Id { get; set; } + /// The name of the resource + string Name { get; set; } + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData SystemData { get; set; } + /// The timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// The identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// The type of identity that created the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// The identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.json.cs new file mode 100644 index 00000000000..8beac881248 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Resource.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Common fields that are returned in the response for all Azure Resource Manager resources + /// + public partial class Resource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResource. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResource. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new Resource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal Resource(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.PowerShell.cs new file mode 100644 index 00000000000..fbdec0763d5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Msi identity details of the resource + [System.ComponentModel.TypeConverter(typeof(ResourceIdentityTypeConverter))] + public partial class ResourceIdentity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceIdentity(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.DataBox.Models.IResourceIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceIdentity(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.DataBox.Models.IResourceIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceIdentity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("PrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).PrincipalId, global::System.Convert.ToString); + } + if (content.Contains("TenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).TenantId, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).UserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities) content.GetValueForProperty("UserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).UserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceIdentity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("PrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).PrincipalId, global::System.Convert.ToString); + } + if (content.Contains("TenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).TenantId, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).UserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities) content.GetValueForProperty("UserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal)this).UserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Msi identity details of the resource + [System.ComponentModel.TypeConverter(typeof(ResourceIdentityTypeConverter))] + public partial interface IResourceIdentity + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.TypeConverter.cs new file mode 100644 index 00000000000..b00607b948c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceIdentityTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceIdentity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceIdentity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceIdentity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.cs new file mode 100644 index 00000000000..ab89c6dc1b7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Msi identity details of the resource + public partial class ResourceIdentity : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal + { + + /// Internal Acessors for PrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal.PrincipalId { get => this._principalId; set { {_principalId = value;} } } + + /// Internal Acessors for TenantId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityInternal.TenantId { get => this._tenantId; set { {_tenantId = value;} } } + + /// Backing field for property. + private string _principalId; + + /// Service Principal Id backing the Msi + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string PrincipalId { get => this._principalId; } + + /// Backing field for property. + private string _tenantId; + + /// Home Tenant Id + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string TenantId { get => this._tenantId; } + + /// Backing field for property. + private string _type; + + /// Identity type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities _userAssignedIdentity; + + /// User Assigned Identities + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities UserAssignedIdentity { get => (this._userAssignedIdentity = this._userAssignedIdentity ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityUserAssignedIdentities()); set => this._userAssignedIdentity = value; } + + /// Creates an new instance. + public ResourceIdentity() + { + + } + } + /// Msi identity details of the resource + public partial interface IResourceIdentity : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Service Principal Id backing the Msi + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Service Principal Id backing the Msi", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string PrincipalId { get; } + /// Home Tenant Id + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Home Tenant Id", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string TenantId { get; } + /// Identity type + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Identity type", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + /// User Assigned Identities + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"User Assigned Identities", + SerializedName = @"userAssignedIdentities", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities UserAssignedIdentity { get; set; } + + } + /// Msi identity details of the resource + internal partial interface IResourceIdentityInternal + + { + /// Service Principal Id backing the Msi + string PrincipalId { get; set; } + /// Home Tenant Id + string TenantId { get; set; } + /// Identity type + string Type { get; set; } + /// User Assigned Identities + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities UserAssignedIdentity { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.json.cs new file mode 100644 index 00000000000..caec1af4237 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentity.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Msi identity details of the resource + public partial class ResourceIdentity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ResourceIdentity(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceIdentity(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + {_principalId = If( json?.PropertyT("principalId"), out var __jsonPrincipalId) ? (string)__jsonPrincipalId : (string)_principalId;} + {_tenantId = If( json?.PropertyT("tenantId"), out var __jsonTenantId) ? (string)__jsonTenantId : (string)_tenantId;} + {_userAssignedIdentity = If( json?.PropertyT("userAssignedIdentities"), out var __jsonUserAssignedIdentities) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityUserAssignedIdentities.FromJson(__jsonUserAssignedIdentities) : _userAssignedIdentity;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._principalId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._principalId.ToString()) : null, "principalId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._tenantId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._tenantId.ToString()) : null, "tenantId" ,container.Add ); + } + AddIf( null != this._userAssignedIdentity ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._userAssignedIdentity.ToJson(null,serializationMode) : null, "userAssignedIdentities" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.PowerShell.cs new file mode 100644 index 00000000000..a71aec01281 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.PowerShell.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// User Assigned Identities + [System.ComponentModel.TypeConverter(typeof(ResourceIdentityUserAssignedIdentitiesTypeConverter))] + public partial class ResourceIdentityUserAssignedIdentities + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceIdentityUserAssignedIdentities(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.DataBox.Models.IResourceIdentityUserAssignedIdentities DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceIdentityUserAssignedIdentities(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.DataBox.Models.IResourceIdentityUserAssignedIdentities FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceIdentityUserAssignedIdentities(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceIdentityUserAssignedIdentities(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// User Assigned Identities + [System.ComponentModel.TypeConverter(typeof(ResourceIdentityUserAssignedIdentitiesTypeConverter))] + public partial interface IResourceIdentityUserAssignedIdentities + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.TypeConverter.cs new file mode 100644 index 00000000000..cba001bb508 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceIdentityUserAssignedIdentitiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceIdentityUserAssignedIdentities.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceIdentityUserAssignedIdentities.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceIdentityUserAssignedIdentities.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.cs new file mode 100644 index 00000000000..692239cf791 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// User Assigned Identities + public partial class ResourceIdentityUserAssignedIdentities : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentitiesInternal + { + + /// Creates an new instance. + public ResourceIdentityUserAssignedIdentities() + { + + } + } + /// User Assigned Identities + public partial interface IResourceIdentityUserAssignedIdentities : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + + } + /// User Assigned Identities + internal partial interface IResourceIdentityUserAssignedIdentitiesInternal + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.dictionary.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.dictionary.cs new file mode 100644 index 00000000000..3570b7cbdb8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.dictionary.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class ResourceIdentityUserAssignedIdentities : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentity this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentity value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentity value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ResourceIdentityUserAssignedIdentities source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.json.cs new file mode 100644 index 00000000000..619faabfdfd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ResourceIdentityUserAssignedIdentities.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// User Assigned Identities + public partial class ResourceIdentityUserAssignedIdentities + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceIdentityUserAssignedIdentities FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ResourceIdentityUserAssignedIdentities(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + /// + internal ResourceIdentityUserAssignedIdentities(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, (j) => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedIdentity.FromJson(j) ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.PowerShell.cs new file mode 100644 index 00000000000..34da40b9f88 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.PowerShell.cs @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Reverse Shipping Address and contact details for a job. + [System.ComponentModel.TypeConverter(typeof(ReverseShippingDetailsTypeConverter))] + public partial class ReverseShippingDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReverseShippingDetails(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.DataBox.Models.IReverseShippingDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReverseShippingDetails(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.DataBox.Models.IReverseShippingDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReverseShippingDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("IsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).IsUpdated = (bool?) content.GetValueForProperty("IsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).IsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailContactName = (string) content.GetValueForProperty("ContactDetailContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailPhone = (string) content.GetValueForProperty("ContactDetailPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailPhoneExtension = (string) content.GetValueForProperty("ContactDetailPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailMobile = (string) content.GetValueForProperty("ContactDetailMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailMobile, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressCity = (string) content.GetValueForProperty("ShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStateOrProvince = (string) content.GetValueForProperty("ShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressCountry = (string) content.GetValueForProperty("ShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressPostalCode = (string) content.GetValueForProperty("ShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressCompanyName = (string) content.GetValueForProperty("ShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressTaxIdentificationNumber, 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 ReverseShippingDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("IsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).IsUpdated = (bool?) content.GetValueForProperty("IsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).IsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailContactName = (string) content.GetValueForProperty("ContactDetailContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailPhone = (string) content.GetValueForProperty("ContactDetailPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailPhoneExtension = (string) content.GetValueForProperty("ContactDetailPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailMobile = (string) content.GetValueForProperty("ContactDetailMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ContactDetailMobile, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressCity = (string) content.GetValueForProperty("ShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStateOrProvince = (string) content.GetValueForProperty("ShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressCountry = (string) content.GetValueForProperty("ShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressPostalCode = (string) content.GetValueForProperty("ShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressCompanyName = (string) content.GetValueForProperty("ShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)this).ShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Reverse Shipping Address and contact details for a job. + [System.ComponentModel.TypeConverter(typeof(ReverseShippingDetailsTypeConverter))] + public partial interface IReverseShippingDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.TypeConverter.cs new file mode 100644 index 00000000000..88429d1a90a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReverseShippingDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReverseShippingDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReverseShippingDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReverseShippingDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.cs new file mode 100644 index 00000000000..eaea07877b5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.cs @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Reverse Shipping Address and contact details for a job. + public partial class ReverseShippingDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo _contactDetail; + + /// Contact Info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo ContactDetail { get => (this._contactDetail = this._contactDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfo()); set => this._contactDetail = value; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ContactDetailContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)ContactDetail).ContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)ContactDetail).ContactName = value ?? null; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ContactDetailMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)ContactDetail).Mobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)ContactDetail).Mobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ContactDetailPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)ContactDetail).Phone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)ContactDetail).Phone = value ?? null; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ContactDetailPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)ContactDetail).PhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfoInternal)ContactDetail).PhoneExtension = value ?? null; } + + /// Backing field for property. + private bool? _isUpdated; + + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? IsUpdated { get => this._isUpdated; } + + /// Internal Acessors for ContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal.ContactDetail { get => (this._contactDetail = this._contactDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfo()); set { {_contactDetail = value;} } } + + /// Internal Acessors for IsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal.IsUpdated { get => this._isUpdated; set { {_isUpdated = value;} } } + + /// Internal Acessors for ShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal.ShippingAddress { get => (this._shippingAddress = this._shippingAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress()); set { {_shippingAddress = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress _shippingAddress; + + /// Shipping address where customer wishes to receive the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ShippingAddress { get => (this._shippingAddress = this._shippingAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress()); set => this._shippingAddress = value; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).City = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressCompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).CompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).CompanyName = value ?? null; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressCountry { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).Country = value ?? null; } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).PostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).PostalCode = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? ShippingAddressSkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).SkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).SkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressStreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressTaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).TaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).TaxIdentificationNumber = value ?? null; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).AddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).AddressType = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).ZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).ZipExtendedCode = value ?? null; } + + /// Creates an new instance. + public ReverseShippingDetails() + { + + } + } + /// Reverse Shipping Address and contact details for a job. + public partial interface IReverseShippingDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Contact name of the person.", + SerializedName = @"contactName", + PossibleTypes = new [] { typeof(string) })] + string ContactDetailContactName { get; set; } + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Mobile number of the contact person.", + SerializedName = @"mobile", + PossibleTypes = new [] { typeof(string) })] + string ContactDetailMobile { get; set; } + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone number of the contact person.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ContactDetailPhone { get; set; } + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone extension number of the contact person.", + SerializedName = @"phoneExtension", + PossibleTypes = new [] { typeof(string) })] + string ContactDetailPhoneExtension { get; set; } + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + Read only field", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? IsUpdated { get; } + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the City.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressCity { get; set; } + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the company.", + SerializedName = @"companyName", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressCompanyName { get; set; } + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the Country.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressCountry { get; set; } + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Postal code.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressPostalCode { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Flag to indicate if customer has chosen to skip default address validation", + SerializedName = @"skipAddressValidation", + PossibleTypes = new [] { typeof(bool) })] + bool? ShippingAddressSkipAddressValidation { get; set; } + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the State or Province.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressStateOrProvince { get; set; } + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 1.", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressStreetAddress1 { get; set; } + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 2.", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressStreetAddress2 { get; set; } + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 3.", + SerializedName = @"streetAddress3", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressStreetAddress3 { get; set; } + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Tax Identification Number", + SerializedName = @"taxIdentificationNumber", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressTaxIdentificationNumber { get; set; } + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of address.", + SerializedName = @"addressType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string ShippingAddressType { get; set; } + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Extended Zip Code.", + SerializedName = @"zipExtendedCode", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressZipExtendedCode { get; set; } + + } + /// Reverse Shipping Address and contact details for a job. + internal partial interface IReverseShippingDetailsInternal + + { + /// Contact Info. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo ContactDetail { get; set; } + /// Contact name of the person. + string ContactDetailContactName { get; set; } + /// Mobile number of the contact person. + string ContactDetailMobile { get; set; } + /// Phone number of the contact person. + string ContactDetailPhone { get; set; } + /// Phone extension number of the contact person. + string ContactDetailPhoneExtension { get; set; } + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + bool? IsUpdated { get; set; } + /// Shipping address where customer wishes to receive the device. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ShippingAddress { get; set; } + /// Name of the City. + string ShippingAddressCity { get; set; } + /// Name of the company. + string ShippingAddressCompanyName { get; set; } + /// Name of the Country. + string ShippingAddressCountry { get; set; } + /// Postal code. + string ShippingAddressPostalCode { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + bool? ShippingAddressSkipAddressValidation { get; set; } + /// Name of the State or Province. + string ShippingAddressStateOrProvince { get; set; } + /// Street Address line 1. + string ShippingAddressStreetAddress1 { get; set; } + /// Street Address line 2. + string ShippingAddressStreetAddress2 { get; set; } + /// Street Address line 3. + string ShippingAddressStreetAddress3 { get; set; } + /// Tax Identification Number + string ShippingAddressTaxIdentificationNumber { get; set; } + /// Type of address. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string ShippingAddressType { get; set; } + /// Extended Zip Code. + string ShippingAddressZipExtendedCode { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.json.cs new file mode 100644 index 00000000000..bdbc3aea41a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ReverseShippingDetails.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Reverse Shipping Address and contact details for a job. + public partial class ReverseShippingDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ReverseShippingDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ReverseShippingDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_contactDetail = If( json?.PropertyT("contactDetails"), out var __jsonContactDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfo.FromJson(__jsonContactDetails) : _contactDetail;} + {_shippingAddress = If( json?.PropertyT("shippingAddress"), out var __jsonShippingAddress) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress.FromJson(__jsonShippingAddress) : _shippingAddress;} + {_isUpdated = If( json?.PropertyT("isUpdated"), out var __jsonIsUpdated) ? (bool?)__jsonIsUpdated : _isUpdated;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._contactDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._contactDetail.ToJson(null,serializationMode) : null, "contactDetails" ,container.Add ); + AddIf( null != this._shippingAddress ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._shippingAddress.ToJson(null,serializationMode) : null, "shippingAddress" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._isUpdated ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._isUpdated) : null, "isUpdated" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.PowerShell.cs new file mode 100644 index 00000000000..13c4957f3c5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request body to get the availability for scheduling orders. + [System.ComponentModel.TypeConverter(typeof(ScheduleAvailabilityRequestTypeConverter))] + public partial class ScheduleAvailabilityRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ScheduleAvailabilityRequest(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.DataBox.Models.IScheduleAvailabilityRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ScheduleAvailabilityRequest(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.DataBox.Models.IScheduleAvailabilityRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ScheduleAvailabilityRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation = (string) content.GetValueForProperty("StorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model, 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 ScheduleAvailabilityRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation = (string) content.GetValueForProperty("StorageLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).StorageLocation, global::System.Convert.ToString); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal)this).Model, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Request body to get the availability for scheduling orders. + [System.ComponentModel.TypeConverter(typeof(ScheduleAvailabilityRequestTypeConverter))] + public partial interface IScheduleAvailabilityRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.TypeConverter.cs new file mode 100644 index 00000000000..e4ac524a877 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ScheduleAvailabilityRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ScheduleAvailabilityRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ScheduleAvailabilityRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ScheduleAvailabilityRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.cs new file mode 100644 index 00000000000..a7f2a610540 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the availability for scheduling orders. + public partial class ScheduleAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequestInternal + { + + /// Backing field for property. + private string _country; + + /// Country in which storage location should be supported. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Country { get => this._country; set => this._country = value; } + + /// Backing field for property. + private string _model; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Model { get => this._model; set => this._model = value; } + + /// Backing field for property. + private string _skuName; + + /// Sku Name for which the order is to be scheduled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string SkuName { get => this._skuName; set => this._skuName = value; } + + /// Backing field for property. + private string _storageLocation; + + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StorageLocation { get => this._storageLocation; set => this._storageLocation = value; } + + /// Creates an new instance. + public ScheduleAvailabilityRequest() + { + + } + } + /// Request body to get the availability for scheduling orders. + public partial interface IScheduleAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Country in which storage location should be supported. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Country in which storage location should be supported.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string Country { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Sku Name for which the order is to be scheduled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Sku Name for which the order is to be scheduled.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string SkuName { get; set; } + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"storageLocation", + PossibleTypes = new [] { typeof(string) })] + string StorageLocation { get; set; } + + } + /// Request body to get the availability for scheduling orders. + internal partial interface IScheduleAvailabilityRequestInternal + + { + /// Country in which storage location should be supported. + string Country { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Sku Name for which the order is to be scheduled. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string SkuName { get; set; } + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + string StorageLocation { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.json.cs new file mode 100644 index 00000000000..c58c7f941d4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityRequest.json.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the availability for scheduling orders. + public partial class ScheduleAvailabilityRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest interface is polymorphic, and + /// the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("skuName") ) + { + case "DataBox": + { + return new DataBoxScheduleAvailabilityRequest(json); + } + case "DataBoxDisk": + { + return new DiskScheduleAvailabilityRequest(json); + } + case "DataBoxHeavy": + { + return new HeavyScheduleAvailabilityRequest(json); + } + } + return new ScheduleAvailabilityRequest(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ScheduleAvailabilityRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_storageLocation = If( json?.PropertyT("storageLocation"), out var __jsonStorageLocation) ? (string)__jsonStorageLocation : (string)_storageLocation;} + {_skuName = If( json?.PropertyT("skuName"), out var __jsonSkuName) ? (string)__jsonSkuName : (string)_skuName;} + {_country = If( json?.PropertyT("country"), out var __jsonCountry) ? (string)__jsonCountry : (string)_country;} + {_model = If( json?.PropertyT("model"), out var __jsonModel) ? (string)__jsonModel : (string)_model;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._storageLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._storageLocation.ToString()) : null, "storageLocation" ,container.Add ); + AddIf( null != (((object)this._skuName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._skuName.ToString()) : null, "skuName" ,container.Add ); + AddIf( null != (((object)this._country)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._country.ToString()) : null, "country" ,container.Add ); + AddIf( null != (((object)this._model)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._model.ToString()) : null, "model" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.PowerShell.cs new file mode 100644 index 00000000000..45d4aa8ce27 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Schedule availability for given sku in a region. + [System.ComponentModel.TypeConverter(typeof(ScheduleAvailabilityResponseTypeConverter))] + public partial class ScheduleAvailabilityResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ScheduleAvailabilityResponse(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.DataBox.Models.IScheduleAvailabilityResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ScheduleAvailabilityResponse(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.DataBox.Models.IScheduleAvailabilityResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ScheduleAvailabilityResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AvailableDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponseInternal)this).AvailableDate = (System.Collections.Generic.List) content.GetValueForProperty("AvailableDate",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponseInternal)this).AvailableDate, __y => TypeConverterExtensions.SelectToList(__y, (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 . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ScheduleAvailabilityResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AvailableDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponseInternal)this).AvailableDate = (System.Collections.Generic.List) content.GetValueForProperty("AvailableDate",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponseInternal)this).AvailableDate, __y => TypeConverterExtensions.SelectToList(__y, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Schedule availability for given sku in a region. + [System.ComponentModel.TypeConverter(typeof(ScheduleAvailabilityResponseTypeConverter))] + public partial interface IScheduleAvailabilityResponse + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.TypeConverter.cs new file mode 100644 index 00000000000..0c51e19d7c5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ScheduleAvailabilityResponseTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ScheduleAvailabilityResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ScheduleAvailabilityResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ScheduleAvailabilityResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.cs new file mode 100644 index 00000000000..ab968b03534 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Schedule availability for given sku in a region. + public partial class ScheduleAvailabilityResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponseInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _availableDate; + + /// List of dates available to schedule + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List AvailableDate { get => this._availableDate; } + + /// Internal Acessors for AvailableDate + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponseInternal.AvailableDate { get => this._availableDate; set { {_availableDate = value;} } } + + /// Creates an new instance. + public ScheduleAvailabilityResponse() + { + + } + } + /// Schedule availability for given sku in a region. + public partial interface IScheduleAvailabilityResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// List of dates available to schedule + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of dates available to schedule", + SerializedName = @"availableDates", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + System.Collections.Generic.List AvailableDate { get; } + + } + /// Schedule availability for given sku in a region. + internal partial interface IScheduleAvailabilityResponseInternal + + { + /// List of dates available to schedule + System.Collections.Generic.List AvailableDate { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.json.cs new file mode 100644 index 00000000000..22e7685d867 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ScheduleAvailabilityResponse.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Schedule availability for given sku in a region. + public partial class ScheduleAvailabilityResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IScheduleAvailabilityResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ScheduleAvailabilityResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ScheduleAvailabilityResponse(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_availableDate = If( json?.PropertyT("availableDates"), out var __jsonAvailableDates) ? If( __jsonAvailableDates as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(global::System.DateTime) (__u is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString __t ? global::System.DateTime.TryParse((string)__t, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __tValue) ? __tValue : default(global::System.DateTime) : default(global::System.DateTime))) ))() : null : _availableDate;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._availableDate) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._availableDate ) + { + AddIf((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__x.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) ,__w.Add); + } + container.Add("availableDates",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.PowerShell.cs new file mode 100644 index 00000000000..6bfec4a1941 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.PowerShell.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Credential details of the shares in account. + [System.ComponentModel.TypeConverter(typeof(ShareCredentialDetailsTypeConverter))] + public partial class ShareCredentialDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ShareCredentialDetails(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.DataBox.Models.IShareCredentialDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ShareCredentialDetails(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.DataBox.Models.IShareCredentialDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ShareCredentialDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ShareName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).ShareName = (string) content.GetValueForProperty("ShareName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).ShareName, global::System.Convert.ToString); + } + if (content.Contains("ShareType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).ShareType = (string) content.GetValueForProperty("ShareType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).ShareType, global::System.Convert.ToString); + } + if (content.Contains("UserName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).UserName, global::System.Convert.ToString); + } + if (content.Contains("Password")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).Password, global::System.Convert.ToString); + } + if (content.Contains("SupportedAccessProtocol")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).SupportedAccessProtocol = (System.Collections.Generic.List) content.GetValueForProperty("SupportedAccessProtocol",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).SupportedAccessProtocol, __y => TypeConverterExtensions.SelectToList(__y, 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 ShareCredentialDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ShareName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).ShareName = (string) content.GetValueForProperty("ShareName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).ShareName, global::System.Convert.ToString); + } + if (content.Contains("ShareType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).ShareType = (string) content.GetValueForProperty("ShareType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).ShareType, global::System.Convert.ToString); + } + if (content.Contains("UserName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).UserName, global::System.Convert.ToString); + } + if (content.Contains("Password")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).Password, global::System.Convert.ToString); + } + if (content.Contains("SupportedAccessProtocol")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).SupportedAccessProtocol = (System.Collections.Generic.List) content.GetValueForProperty("SupportedAccessProtocol",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal)this).SupportedAccessProtocol, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Credential details of the shares in account. + [System.ComponentModel.TypeConverter(typeof(ShareCredentialDetailsTypeConverter))] + public partial interface IShareCredentialDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.TypeConverter.cs new file mode 100644 index 00000000000..87860c2e47f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ShareCredentialDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ShareCredentialDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ShareCredentialDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ShareCredentialDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.cs new file mode 100644 index 00000000000..412a2983787 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Credential details of the shares in account. + public partial class ShareCredentialDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal + { + + /// Internal Acessors for Password + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal.Password { get => this._password; set { {_password = value;} } } + + /// Internal Acessors for ShareName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal.ShareName { get => this._shareName; set { {_shareName = value;} } } + + /// Internal Acessors for ShareType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal.ShareType { get => this._shareType; set { {_shareType = value;} } } + + /// Internal Acessors for SupportedAccessProtocol + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal.SupportedAccessProtocol { get => this._supportedAccessProtocol; set { {_supportedAccessProtocol = value;} } } + + /// Internal Acessors for UserName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetailsInternal.UserName { get => this._userName; set { {_userName = value;} } } + + /// Backing field for property. + private string _password; + + /// Password for the share. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Password { get => this._password; } + + /// Backing field for property. + private string _shareName; + + /// Name of the share. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ShareName { get => this._shareName; } + + /// Backing field for property. + private string _shareType; + + /// Type of the share. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ShareType { get => this._shareType; } + + /// Backing field for property. + private System.Collections.Generic.List _supportedAccessProtocol; + + /// Access protocols supported on the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List SupportedAccessProtocol { get => this._supportedAccessProtocol; } + + /// Backing field for property. + private string _userName; + + /// User name for the share. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string UserName { get => this._userName; } + + /// Creates an new instance. + public ShareCredentialDetails() + { + + } + } + /// Credential details of the shares in account. + public partial interface IShareCredentialDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Password for the share. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Password for the share.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; } + /// Name of the share. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the share.", + SerializedName = @"shareName", + PossibleTypes = new [] { typeof(string) })] + string ShareName { get; } + /// Type of the share. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Type of the share.", + SerializedName = @"shareType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("UnknownType", "HCS", "BlockBlob", "PageBlob", "AzureFile", "ManagedDisk")] + string ShareType { get; } + /// Access protocols supported on the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Access protocols supported on the device.", + SerializedName = @"supportedAccessProtocols", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("SMB", "NFS")] + System.Collections.Generic.List SupportedAccessProtocol { get; } + /// User name for the share. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"User name for the share.", + SerializedName = @"userName", + PossibleTypes = new [] { typeof(string) })] + string UserName { get; } + + } + /// Credential details of the shares in account. + internal partial interface IShareCredentialDetailsInternal + + { + /// Password for the share. + string Password { get; set; } + /// Name of the share. + string ShareName { get; set; } + /// Type of the share. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("UnknownType", "HCS", "BlockBlob", "PageBlob", "AzureFile", "ManagedDisk")] + string ShareType { get; set; } + /// Access protocols supported on the device. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("SMB", "NFS")] + System.Collections.Generic.List SupportedAccessProtocol { get; set; } + /// User name for the share. + string UserName { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.json.cs new file mode 100644 index 00000000000..0494d90b7a2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShareCredentialDetails.json.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Credential details of the shares in account. + public partial class ShareCredentialDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShareCredentialDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ShareCredentialDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ShareCredentialDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_shareName = If( json?.PropertyT("shareName"), out var __jsonShareName) ? (string)__jsonShareName : (string)_shareName;} + {_shareType = If( json?.PropertyT("shareType"), out var __jsonShareType) ? (string)__jsonShareType : (string)_shareType;} + {_userName = If( json?.PropertyT("userName"), out var __jsonUserName) ? (string)__jsonUserName : (string)_userName;} + {_password = If( json?.PropertyT("password"), out var __jsonPassword) ? (string)__jsonPassword : (string)_password;} + {_supportedAccessProtocol = If( json?.PropertyT("supportedAccessProtocols"), out var __jsonSupportedAccessProtocols) ? If( __jsonSupportedAccessProtocols as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _supportedAccessProtocol;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._shareName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._shareName.ToString()) : null, "shareName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._shareType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._shareType.ToString()) : null, "shareType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._userName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._userName.ToString()) : null, "userName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._password)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._password.ToString()) : null, "password" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._supportedAccessProtocol) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._supportedAccessProtocol ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("supportedAccessProtocols",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.PowerShell.cs new file mode 100644 index 00000000000..cb4a2c25c54 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Shipment pick up request details. + [System.ComponentModel.TypeConverter(typeof(ShipmentPickUpRequestTypeConverter))] + public partial class ShipmentPickUpRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ShipmentPickUpRequest(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.DataBox.Models.IShipmentPickUpRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ShipmentPickUpRequest(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.DataBox.Models.IShipmentPickUpRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ShipmentPickUpRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal)this).StartTime = (global::System.DateTime) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal)this).EndTime = (global::System.DateTime) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ShipmentLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal)this).ShipmentLocation = (string) content.GetValueForProperty("ShipmentLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal)this).ShipmentLocation, 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 ShipmentPickUpRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal)this).StartTime = (global::System.DateTime) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal)this).EndTime = (global::System.DateTime) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ShipmentLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal)this).ShipmentLocation = (string) content.GetValueForProperty("ShipmentLocation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal)this).ShipmentLocation, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Shipment pick up request details. + [System.ComponentModel.TypeConverter(typeof(ShipmentPickUpRequestTypeConverter))] + public partial interface IShipmentPickUpRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.TypeConverter.cs new file mode 100644 index 00000000000..39d6aa9b4e2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ShipmentPickUpRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ShipmentPickUpRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ShipmentPickUpRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ShipmentPickUpRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.cs new file mode 100644 index 00000000000..4a069ff957d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Shipment pick up request details. + public partial class ShipmentPickUpRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequestInternal + { + + /// Backing field for property. + private global::System.DateTime _endTime; + + /// + /// Maximum date before which the pick up should commence, this must be in local time of pick up area. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public global::System.DateTime EndTime { get => this._endTime; set => this._endTime = value; } + + /// Backing field for property. + private string _shipmentLocation; + + /// Shipment Location in the pickup place. Eg.front desk + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ShipmentLocation { get => this._shipmentLocation; set => this._shipmentLocation = value; } + + /// Backing field for property. + private global::System.DateTime _startTime; + + /// + /// Minimum date after which the pick up should commence, this must be in local time of pick up area. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public global::System.DateTime StartTime { get => this._startTime; set => this._startTime = value; } + + /// Creates an new instance. + public ShipmentPickUpRequest() + { + + } + } + /// Shipment pick up request details. + public partial interface IShipmentPickUpRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// + /// Maximum date before which the pick up should commence, this must be in local time of pick up area. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Maximum date before which the pick up should commence, this must be in local time of pick up area.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime EndTime { get; set; } + /// Shipment Location in the pickup place. Eg.front desk + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Shipment Location in the pickup place. Eg.front desk", + SerializedName = @"shipmentLocation", + PossibleTypes = new [] { typeof(string) })] + string ShipmentLocation { get; set; } + /// + /// Minimum date after which the pick up should commence, this must be in local time of pick up area. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Minimum date after which the pick up should commence, this must be in local time of pick up area.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime StartTime { get; set; } + + } + /// Shipment pick up request details. + internal partial interface IShipmentPickUpRequestInternal + + { + /// + /// Maximum date before which the pick up should commence, this must be in local time of pick up area. + /// + global::System.DateTime EndTime { get; set; } + /// Shipment Location in the pickup place. Eg.front desk + string ShipmentLocation { get; set; } + /// + /// Minimum date after which the pick up should commence, this must be in local time of pick up area. + /// + global::System.DateTime StartTime { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.json.cs new file mode 100644 index 00000000000..dffaf4be2b4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpRequest.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Shipment pick up request details. + public partial class ShipmentPickUpRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ShipmentPickUpRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ShipmentPickUpRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : _startTime : _startTime;} + {_endTime = If( json?.PropertyT("endTime"), out var __jsonEndTime) ? global::System.DateTime.TryParse((string)__jsonEndTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonEndTimeValue) ? __jsonEndTimeValue : _endTime : _endTime;} + {_shipmentLocation = If( json?.PropertyT("shipmentLocation"), out var __jsonShipmentLocation) ? (string)__jsonShipmentLocation : (string)_shipmentLocation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._startTime.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)), "startTime" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._endTime.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)), "endTime" ,container.Add ); + AddIf( null != (((object)this._shipmentLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._shipmentLocation.ToString()) : null, "shipmentLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.PowerShell.cs new file mode 100644 index 00000000000..8897ac5464f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Shipment pick up response. + [System.ComponentModel.TypeConverter(typeof(ShipmentPickUpResponseTypeConverter))] + public partial class ShipmentPickUpResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ShipmentPickUpResponse(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.DataBox.Models.IShipmentPickUpResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ShipmentPickUpResponse(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.DataBox.Models.IShipmentPickUpResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ShipmentPickUpResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ConfirmationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponseInternal)this).ConfirmationNumber = (string) content.GetValueForProperty("ConfirmationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponseInternal)this).ConfirmationNumber, global::System.Convert.ToString); + } + if (content.Contains("ReadyByTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponseInternal)this).ReadyByTime = (global::System.DateTime?) content.GetValueForProperty("ReadyByTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponseInternal)this).ReadyByTime, (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 . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ShipmentPickUpResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ConfirmationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponseInternal)this).ConfirmationNumber = (string) content.GetValueForProperty("ConfirmationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponseInternal)this).ConfirmationNumber, global::System.Convert.ToString); + } + if (content.Contains("ReadyByTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponseInternal)this).ReadyByTime = (global::System.DateTime?) content.GetValueForProperty("ReadyByTime",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponseInternal)this).ReadyByTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Shipment pick up response. + [System.ComponentModel.TypeConverter(typeof(ShipmentPickUpResponseTypeConverter))] + public partial interface IShipmentPickUpResponse + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.TypeConverter.cs new file mode 100644 index 00000000000..d863e972a26 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ShipmentPickUpResponseTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ShipmentPickUpResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ShipmentPickUpResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ShipmentPickUpResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.cs new file mode 100644 index 00000000000..9d32273cd9c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Shipment pick up response. + public partial class ShipmentPickUpResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponseInternal + { + + /// Backing field for property. + private string _confirmationNumber; + + /// Confirmation number for the pick up request. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ConfirmationNumber { get => this._confirmationNumber; } + + /// Internal Acessors for ConfirmationNumber + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponseInternal.ConfirmationNumber { get => this._confirmationNumber; set { {_confirmationNumber = value;} } } + + /// Internal Acessors for ReadyByTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponseInternal.ReadyByTime { get => this._readyByTime; set { {_readyByTime = value;} } } + + /// Backing field for property. + private global::System.DateTime? _readyByTime; + + /// + /// Time by which shipment should be ready for pick up, this is in local time of pick up area. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public global::System.DateTime? ReadyByTime { get => this._readyByTime; } + + /// Creates an new instance. + public ShipmentPickUpResponse() + { + + } + } + /// Shipment pick up response. + public partial interface IShipmentPickUpResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Confirmation number for the pick up request. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Confirmation number for the pick up request.", + SerializedName = @"confirmationNumber", + PossibleTypes = new [] { typeof(string) })] + string ConfirmationNumber { get; } + /// + /// Time by which shipment should be ready for pick up, this is in local time of pick up area. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Time by which shipment should be ready for pick up, this is in local time of pick up area.", + SerializedName = @"readyByTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ReadyByTime { get; } + + } + /// Shipment pick up response. + internal partial interface IShipmentPickUpResponseInternal + + { + /// Confirmation number for the pick up request. + string ConfirmationNumber { get; set; } + /// + /// Time by which shipment should be ready for pick up, this is in local time of pick up area. + /// + global::System.DateTime? ReadyByTime { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.json.cs new file mode 100644 index 00000000000..1bf5639e308 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShipmentPickUpResponse.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Shipment pick up response. + public partial class ShipmentPickUpResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ShipmentPickUpResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ShipmentPickUpResponse(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_confirmationNumber = If( json?.PropertyT("confirmationNumber"), out var __jsonConfirmationNumber) ? (string)__jsonConfirmationNumber : (string)_confirmationNumber;} + {_readyByTime = If( json?.PropertyT("readyByTime"), out var __jsonReadyByTime) ? global::System.DateTime.TryParse((string)__jsonReadyByTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonReadyByTimeValue) ? __jsonReadyByTimeValue : _readyByTime : _readyByTime;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._confirmationNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._confirmationNumber.ToString()) : null, "confirmationNumber" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._readyByTime ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._readyByTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "readyByTime" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.PowerShell.cs new file mode 100644 index 00000000000..78aaf826618 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.PowerShell.cs @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Shipping address where customer wishes to receive the device. + [System.ComponentModel.TypeConverter(typeof(ShippingAddressTypeConverter))] + public partial class ShippingAddress + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ShippingAddress(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.DataBox.Models.IShippingAddress DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ShippingAddress(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.DataBox.Models.IShippingAddress FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ShippingAddress(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("AddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).AddressType = (string) content.GetValueForProperty("AddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).AddressType, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).TaxIdentificationNumber, 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 ShippingAddress(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("AddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).AddressType = (string) content.GetValueForProperty("AddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).AddressType, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Shipping address where customer wishes to receive the device. + [System.ComponentModel.TypeConverter(typeof(ShippingAddressTypeConverter))] + public partial interface IShippingAddress + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.TypeConverter.cs new file mode 100644 index 00000000000..c961cd87fdd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ShippingAddressTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ShippingAddress.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ShippingAddress.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ShippingAddress.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.cs new file mode 100644 index 00000000000..cd635771225 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.cs @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Shipping address where customer wishes to receive the device. + public partial class ShippingAddress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal + { + + /// Backing field for property. + private string _addressType; + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string AddressType { get => this._addressType; set => this._addressType = value; } + + /// Backing field for property. + private string _city; + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string City { get => this._city; set => this._city = value; } + + /// Backing field for property. + private string _companyName; + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CompanyName { get => this._companyName; set => this._companyName = value; } + + /// Backing field for property. + private string _country; + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Country { get => this._country; set => this._country = value; } + + /// Backing field for property. + private string _postalCode; + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string PostalCode { get => this._postalCode; set => this._postalCode = value; } + + /// Backing field for property. + private bool? _skipAddressValidation; + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? SkipAddressValidation { get => this._skipAddressValidation; set => this._skipAddressValidation = value; } + + /// Backing field for property. + private string _stateOrProvince; + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StateOrProvince { get => this._stateOrProvince; set => this._stateOrProvince = value; } + + /// Backing field for property. + private string _streetAddress1; + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StreetAddress1 { get => this._streetAddress1; set => this._streetAddress1 = value; } + + /// Backing field for property. + private string _streetAddress2; + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StreetAddress2 { get => this._streetAddress2; set => this._streetAddress2 = value; } + + /// Backing field for property. + private string _streetAddress3; + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StreetAddress3 { get => this._streetAddress3; set => this._streetAddress3 = value; } + + /// Backing field for property. + private string _taxIdentificationNumber; + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string TaxIdentificationNumber { get => this._taxIdentificationNumber; set => this._taxIdentificationNumber = value; } + + /// Backing field for property. + private string _zipExtendedCode; + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ZipExtendedCode { get => this._zipExtendedCode; set => this._zipExtendedCode = value; } + + /// Creates an new instance. + public ShippingAddress() + { + + } + } + /// Shipping address where customer wishes to receive the device. + public partial interface IShippingAddress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of address.", + SerializedName = @"addressType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string AddressType { get; set; } + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the City.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string City { get; set; } + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the company.", + SerializedName = @"companyName", + PossibleTypes = new [] { typeof(string) })] + string CompanyName { get; set; } + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the Country.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string Country { get; set; } + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Postal code.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string PostalCode { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Flag to indicate if customer has chosen to skip default address validation", + SerializedName = @"skipAddressValidation", + PossibleTypes = new [] { typeof(bool) })] + bool? SkipAddressValidation { get; set; } + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the State or Province.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string StateOrProvince { get; set; } + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 1.", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress1 { get; set; } + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 2.", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress2 { get; set; } + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 3.", + SerializedName = @"streetAddress3", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress3 { get; set; } + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Tax Identification Number", + SerializedName = @"taxIdentificationNumber", + PossibleTypes = new [] { typeof(string) })] + string TaxIdentificationNumber { get; set; } + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Extended Zip Code.", + SerializedName = @"zipExtendedCode", + PossibleTypes = new [] { typeof(string) })] + string ZipExtendedCode { get; set; } + + } + /// Shipping address where customer wishes to receive the device. + internal partial interface IShippingAddressInternal + + { + /// Type of address. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string AddressType { get; set; } + /// Name of the City. + string City { get; set; } + /// Name of the company. + string CompanyName { get; set; } + /// Name of the Country. + string Country { get; set; } + /// Postal code. + string PostalCode { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + bool? SkipAddressValidation { get; set; } + /// Name of the State or Province. + string StateOrProvince { get; set; } + /// Street Address line 1. + string StreetAddress1 { get; set; } + /// Street Address line 2. + string StreetAddress2 { get; set; } + /// Street Address line 3. + string StreetAddress3 { get; set; } + /// Tax Identification Number + string TaxIdentificationNumber { get; set; } + /// Extended Zip Code. + string ZipExtendedCode { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.json.cs new file mode 100644 index 00000000000..10d75648913 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ShippingAddress.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Shipping address where customer wishes to receive the device. + public partial class ShippingAddress + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ShippingAddress(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ShippingAddress(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_streetAddress1 = If( json?.PropertyT("streetAddress1"), out var __jsonStreetAddress1) ? (string)__jsonStreetAddress1 : (string)_streetAddress1;} + {_streetAddress2 = If( json?.PropertyT("streetAddress2"), out var __jsonStreetAddress2) ? (string)__jsonStreetAddress2 : (string)_streetAddress2;} + {_streetAddress3 = If( json?.PropertyT("streetAddress3"), out var __jsonStreetAddress3) ? (string)__jsonStreetAddress3 : (string)_streetAddress3;} + {_city = If( json?.PropertyT("city"), out var __jsonCity) ? (string)__jsonCity : (string)_city;} + {_stateOrProvince = If( json?.PropertyT("stateOrProvince"), out var __jsonStateOrProvince) ? (string)__jsonStateOrProvince : (string)_stateOrProvince;} + {_country = If( json?.PropertyT("country"), out var __jsonCountry) ? (string)__jsonCountry : (string)_country;} + {_postalCode = If( json?.PropertyT("postalCode"), out var __jsonPostalCode) ? (string)__jsonPostalCode : (string)_postalCode;} + {_zipExtendedCode = If( json?.PropertyT("zipExtendedCode"), out var __jsonZipExtendedCode) ? (string)__jsonZipExtendedCode : (string)_zipExtendedCode;} + {_companyName = If( json?.PropertyT("companyName"), out var __jsonCompanyName) ? (string)__jsonCompanyName : (string)_companyName;} + {_addressType = If( json?.PropertyT("addressType"), out var __jsonAddressType) ? (string)__jsonAddressType : (string)_addressType;} + {_skipAddressValidation = If( json?.PropertyT("skipAddressValidation"), out var __jsonSkipAddressValidation) ? (bool?)__jsonSkipAddressValidation : _skipAddressValidation;} + {_taxIdentificationNumber = If( json?.PropertyT("taxIdentificationNumber"), out var __jsonTaxIdentificationNumber) ? (string)__jsonTaxIdentificationNumber : (string)_taxIdentificationNumber;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._streetAddress1)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._streetAddress1.ToString()) : null, "streetAddress1" ,container.Add ); + AddIf( null != (((object)this._streetAddress2)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._streetAddress2.ToString()) : null, "streetAddress2" ,container.Add ); + AddIf( null != (((object)this._streetAddress3)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._streetAddress3.ToString()) : null, "streetAddress3" ,container.Add ); + AddIf( null != (((object)this._city)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._city.ToString()) : null, "city" ,container.Add ); + AddIf( null != (((object)this._stateOrProvince)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._stateOrProvince.ToString()) : null, "stateOrProvince" ,container.Add ); + AddIf( null != (((object)this._country)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._country.ToString()) : null, "country" ,container.Add ); + AddIf( null != (((object)this._postalCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._postalCode.ToString()) : null, "postalCode" ,container.Add ); + AddIf( null != (((object)this._zipExtendedCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._zipExtendedCode.ToString()) : null, "zipExtendedCode" ,container.Add ); + AddIf( null != (((object)this._companyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._companyName.ToString()) : null, "companyName" ,container.Add ); + AddIf( null != (((object)this._addressType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._addressType.ToString()) : null, "addressType" ,container.Add ); + AddIf( null != this._skipAddressValidation ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._skipAddressValidation) : null, "skipAddressValidation" ,container.Add ); + AddIf( null != (((object)this._taxIdentificationNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._taxIdentificationNumber.ToString()) : null, "taxIdentificationNumber" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.PowerShell.cs new file mode 100644 index 00000000000..dc56858d217 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// The Sku. + [System.ComponentModel.TypeConverter(typeof(SkuTypeConverter))] + public partial class Sku + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Sku(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.DataBox.Models.ISku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Sku(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.DataBox.Models.ISku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Sku(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("Family")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).Family = (string) content.GetValueForProperty("Family",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).Family, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).Model, 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 Sku(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("Family")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).Family = (string) content.GetValueForProperty("Family",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).Family, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)this).Model, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Sku. + [System.ComponentModel.TypeConverter(typeof(SkuTypeConverter))] + public partial interface ISku + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.TypeConverter.cs new file mode 100644 index 00000000000..18aac913e9d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SkuTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Sku.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Sku.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Sku.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.cs new file mode 100644 index 00000000000..abf29585d52 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The Sku. + public partial class Sku : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal + { + + /// Backing field for property. + private string _displayName; + + /// The display name of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DisplayName { get => this._displayName; set => this._displayName = value; } + + /// Backing field for property. + private string _family; + + /// The sku family. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Family { get => this._family; set => this._family = value; } + + /// Backing field for property. + private string _model; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Model { get => this._model; set => this._model = value; } + + /// Backing field for property. + private string _name; + + /// The sku name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Creates an new instance. + public Sku() + { + + } + } + /// The Sku. + public partial interface ISku : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// The display name of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The display name of the sku.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; set; } + /// The sku family. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The sku family.", + SerializedName = @"family", + PossibleTypes = new [] { typeof(string) })] + string Family { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// The sku name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The sku name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string Name { get; set; } + + } + /// The Sku. + internal partial interface ISkuInternal + + { + /// The display name of the sku. + string DisplayName { get; set; } + /// The sku family. + string Family { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// The sku name. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string Name { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.json.cs new file mode 100644 index 00000000000..4e79def64a3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/Sku.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// The Sku. + public partial class Sku + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new Sku(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal Sku(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)_displayName;} + {_family = If( json?.PropertyT("family"), out var __jsonFamily) ? (string)__jsonFamily : (string)_family;} + {_model = If( json?.PropertyT("model"), out var __jsonModel) ? (string)__jsonModel : (string)_model;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); + AddIf( null != (((object)this._family)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._family.ToString()) : null, "family" ,container.Add ); + AddIf( null != (((object)this._model)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._model.ToString()) : null, "model" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.PowerShell.cs new file mode 100644 index 00000000000..fe1d2244a69 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request to validate sku availability. + [System.ComponentModel.TypeConverter(typeof(SkuAvailabilityValidationRequestTypeConverter))] + public partial class SkuAvailabilityValidationRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SkuAvailabilityValidationRequest(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.DataBox.Models.ISkuAvailabilityValidationRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SkuAvailabilityValidationRequest(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.DataBox.Models.ISkuAvailabilityValidationRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SkuAvailabilityValidationRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeviceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).DeviceType = (string) content.GetValueForProperty("DeviceType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).DeviceType, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).Model, global::System.Convert.ToString); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, 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 SkuAvailabilityValidationRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeviceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).DeviceType = (string) content.GetValueForProperty("DeviceType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).DeviceType, global::System.Convert.ToString); + } + if (content.Contains("TransferType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).TransferType = (string) content.GetValueForProperty("TransferType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).TransferType, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal)this).Model, global::System.Convert.ToString); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Request to validate sku availability. + [System.ComponentModel.TypeConverter(typeof(SkuAvailabilityValidationRequestTypeConverter))] + public partial interface ISkuAvailabilityValidationRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.TypeConverter.cs new file mode 100644 index 00000000000..800fd632356 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SkuAvailabilityValidationRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SkuAvailabilityValidationRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SkuAvailabilityValidationRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SkuAvailabilityValidationRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.cs new file mode 100644 index 00000000000..b2e6ab87d50 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request to validate sku availability. + public partial class SkuAvailabilityValidationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequestInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest __validationInputRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest(); + + /// Backing field for property. + private string _country; + + /// + /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Country { get => this._country; set => this._country = value; } + + /// Backing field for property. + private string _deviceType; + + /// Device type to be used for the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DeviceType { get => this._deviceType; set => this._deviceType = value; } + + /// Backing field for property. + private string _location; + + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Backing field for property. + private string _model; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Model { get => this._model; set => this._model = value; } + + /// Backing field for property. + private string _transferType; + + /// Type of the transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string TransferType { get => this._transferType; set => this._transferType = value; } + + /// Identifies the type of validation request. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationType { get => "ValidateSkuAvailability"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)__validationInputRequest).ValidationType = "ValidateSkuAvailability"; } + + /// Creates an new instance. + public SkuAvailabilityValidationRequest() + { + this.__validationInputRequest.ValidationType = "ValidateSkuAvailability"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationInputRequest), __validationInputRequest); + await eventListener.AssertObjectIsValid(nameof(__validationInputRequest), __validationInputRequest); + } + } + /// Request to validate sku availability. + public partial interface ISkuAvailabilityValidationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest + { + /// + /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string Country { get; set; } + /// Device type to be used for the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Device type to be used for the job.", + SerializedName = @"deviceType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DeviceType { get; set; } + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Type of the transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the transfer.", + SerializedName = @"transferType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; set; } + + } + /// Request to validate sku availability. + internal partial interface ISkuAvailabilityValidationRequestInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal + { + /// + /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + /// + string Country { get; set; } + /// Device type to be used for the job. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DeviceType { get; set; } + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + string Location { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Type of the transfer. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + string TransferType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.json.cs new file mode 100644 index 00000000000..ba3fee55f64 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationRequest.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request to validate sku availability. + public partial class SkuAvailabilityValidationRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new SkuAvailabilityValidationRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal SkuAvailabilityValidationRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationInputRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest(json); + {_deviceType = If( json?.PropertyT("deviceType"), out var __jsonDeviceType) ? (string)__jsonDeviceType : (string)_deviceType;} + {_transferType = If( json?.PropertyT("transferType"), out var __jsonTransferType) ? (string)__jsonTransferType : (string)_transferType;} + {_country = If( json?.PropertyT("country"), out var __jsonCountry) ? (string)__jsonCountry : (string)_country;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)_location;} + {_model = If( json?.PropertyT("model"), out var __jsonModel) ? (string)__jsonModel : (string)_model;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationInputRequest?.ToJson(container, serializationMode); + AddIf( null != (((object)this._deviceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._deviceType.ToString()) : null, "deviceType" ,container.Add ); + AddIf( null != (((object)this._transferType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._transferType.ToString()) : null, "transferType" ,container.Add ); + AddIf( null != (((object)this._country)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._country.ToString()) : null, "country" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != (((object)this._model)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._model.ToString()) : null, "model" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.PowerShell.cs new file mode 100644 index 00000000000..77203440aa0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.PowerShell.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Properties of sku availability validation response. + [System.ComponentModel.TypeConverter(typeof(SkuAvailabilityValidationResponsePropertiesTypeConverter))] + public partial class SkuAvailabilityValidationResponseProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponseProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SkuAvailabilityValidationResponseProperties(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.DataBox.Models.ISkuAvailabilityValidationResponseProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SkuAvailabilityValidationResponseProperties(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.DataBox.Models.ISkuAvailabilityValidationResponseProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SkuAvailabilityValidationResponseProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponsePropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponsePropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, 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 SkuAvailabilityValidationResponseProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponsePropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponsePropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 sku availability validation response. + [System.ComponentModel.TypeConverter(typeof(SkuAvailabilityValidationResponsePropertiesTypeConverter))] + public partial interface ISkuAvailabilityValidationResponseProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.TypeConverter.cs new file mode 100644 index 00000000000..983d9d01d7a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SkuAvailabilityValidationResponsePropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponseProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponseProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SkuAvailabilityValidationResponseProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SkuAvailabilityValidationResponseProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SkuAvailabilityValidationResponseProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.cs new file mode 100644 index 00000000000..1ecf7c4439e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of sku availability validation response. + public partial class SkuAvailabilityValidationResponseProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponseProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponsePropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse __validationInputResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse(); + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail; } + + /// Error code and message of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error = value ?? null /* model class */; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message; } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponsePropertiesInternal.Status { get => this._status; set { {_status = value;} } } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error = value ?? null /* model class */; } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target = value ?? null; } + + /// Backing field for property. + private string _status; + + /// Sku availability validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Status { get => this._status; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target; } + + /// Identifies the type of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationType { get => "ValidateSkuAvailability"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).ValidationType = "ValidateSkuAvailability"; } + + /// + /// Creates an new instance. + /// + public SkuAvailabilityValidationResponseProperties() + { + this.__validationInputResponse.ValidationType = "ValidateSkuAvailability"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationInputResponse), __validationInputResponse); + await eventListener.AssertObjectIsValid(nameof(__validationInputResponse), __validationInputResponse); + } + } + /// Properties of sku availability validation response. + public partial interface ISkuAvailabilityValidationResponseProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse + { + /// Sku availability validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Sku availability validation status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Skipped")] + string Status { get; } + + } + /// Properties of sku availability validation response. + internal partial interface ISkuAvailabilityValidationResponsePropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal + { + /// Sku availability validation status. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Skipped")] + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.json.cs new file mode 100644 index 00000000000..1d67a049cdf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuAvailabilityValidationResponseProperties.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of sku availability validation response. + public partial class SkuAvailabilityValidationResponseProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponseProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponseProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationResponseProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new SkuAvailabilityValidationResponseProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal SkuAvailabilityValidationResponseProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationInputResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse(json); + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationInputResponse?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.PowerShell.cs new file mode 100644 index 00000000000..71ccdf249c2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Capacity of the sku. + [System.ComponentModel.TypeConverter(typeof(SkuCapacityTypeConverter))] + public partial class SkuCapacity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SkuCapacity(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.DataBox.Models.ISkuCapacity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SkuCapacity(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.DataBox.Models.ISkuCapacity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SkuCapacity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Usable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)this).Usable = (string) content.GetValueForProperty("Usable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)this).Usable, global::System.Convert.ToString); + } + if (content.Contains("Maximum")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)this).Maximum = (string) content.GetValueForProperty("Maximum",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)this).Maximum, global::System.Convert.ToString); + } + if (content.Contains("IndividualSkuUsable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)this).IndividualSkuUsable = (string) content.GetValueForProperty("IndividualSkuUsable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)this).IndividualSkuUsable, 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 SkuCapacity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Usable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)this).Usable = (string) content.GetValueForProperty("Usable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)this).Usable, global::System.Convert.ToString); + } + if (content.Contains("Maximum")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)this).Maximum = (string) content.GetValueForProperty("Maximum",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)this).Maximum, global::System.Convert.ToString); + } + if (content.Contains("IndividualSkuUsable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)this).IndividualSkuUsable = (string) content.GetValueForProperty("IndividualSkuUsable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)this).IndividualSkuUsable, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Capacity of the sku. + [System.ComponentModel.TypeConverter(typeof(SkuCapacityTypeConverter))] + public partial interface ISkuCapacity + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.TypeConverter.cs new file mode 100644 index 00000000000..6829d7feb3e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SkuCapacityTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SkuCapacity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SkuCapacity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SkuCapacity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.cs new file mode 100644 index 00000000000..41762b553ac --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Capacity of the sku. + public partial class SkuCapacity : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal + { + + /// Backing field for property. + private string _individualSkuUsable; + + /// Maximum capacity per device in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string IndividualSkuUsable { get => this._individualSkuUsable; } + + /// Backing field for property. + private string _maximum; + + /// Maximum capacity in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Maximum { get => this._maximum; } + + /// Internal Acessors for IndividualSkuUsable + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal.IndividualSkuUsable { get => this._individualSkuUsable; set { {_individualSkuUsable = value;} } } + + /// Internal Acessors for Maximum + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal.Maximum { get => this._maximum; set { {_maximum = value;} } } + + /// Internal Acessors for Usable + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal.Usable { get => this._usable; set { {_usable = value;} } } + + /// Backing field for property. + private string _usable; + + /// Usable capacity in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Usable { get => this._usable; } + + /// Creates an new instance. + public SkuCapacity() + { + + } + } + /// Capacity of the sku. + public partial interface ISkuCapacity : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Maximum capacity per device in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Maximum capacity per device in TB.", + SerializedName = @"individualSkuUsable", + PossibleTypes = new [] { typeof(string) })] + string IndividualSkuUsable { get; } + /// Maximum capacity in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Maximum capacity in TB.", + SerializedName = @"maximum", + PossibleTypes = new [] { typeof(string) })] + string Maximum { get; } + /// Usable capacity in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Usable capacity in TB.", + SerializedName = @"usable", + PossibleTypes = new [] { typeof(string) })] + string Usable { get; } + + } + /// Capacity of the sku. + internal partial interface ISkuCapacityInternal + + { + /// Maximum capacity per device in TB. + string IndividualSkuUsable { get; set; } + /// Maximum capacity in TB. + string Maximum { get; set; } + /// Usable capacity in TB. + string Usable { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.json.cs new file mode 100644 index 00000000000..069234df9b4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCapacity.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Capacity of the sku. + public partial class SkuCapacity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new SkuCapacity(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal SkuCapacity(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_usable = If( json?.PropertyT("usable"), out var __jsonUsable) ? (string)__jsonUsable : (string)_usable;} + {_maximum = If( json?.PropertyT("maximum"), out var __jsonMaximum) ? (string)__jsonMaximum : (string)_maximum;} + {_individualSkuUsable = If( json?.PropertyT("individualSkuUsable"), out var __jsonIndividualSkuUsable) ? (string)__jsonIndividualSkuUsable : (string)_individualSkuUsable;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._usable)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._usable.ToString()) : null, "usable" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._maximum)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._maximum.ToString()) : null, "maximum" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._individualSkuUsable)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._individualSkuUsable.ToString()) : null, "individualSkuUsable" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.PowerShell.cs new file mode 100644 index 00000000000..70bbd6663c8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Describes metadata for retrieving price info. + [System.ComponentModel.TypeConverter(typeof(SkuCostTypeConverter))] + public partial class SkuCost + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCost DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SkuCost(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.DataBox.Models.ISkuCost DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SkuCost(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.DataBox.Models.ISkuCost FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SkuCost(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MeterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal)this).MeterId = (string) content.GetValueForProperty("MeterId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal)this).MeterId, global::System.Convert.ToString); + } + if (content.Contains("MeterType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal)this).MeterType = (string) content.GetValueForProperty("MeterType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal)this).MeterType, global::System.Convert.ToString); + } + if (content.Contains("Multiplier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal)this).Multiplier = (double?) content.GetValueForProperty("Multiplier",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal)this).Multiplier, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SkuCost(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MeterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal)this).MeterId = (string) content.GetValueForProperty("MeterId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal)this).MeterId, global::System.Convert.ToString); + } + if (content.Contains("MeterType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal)this).MeterType = (string) content.GetValueForProperty("MeterType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal)this).MeterType, global::System.Convert.ToString); + } + if (content.Contains("Multiplier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal)this).Multiplier = (double?) content.GetValueForProperty("Multiplier",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal)this).Multiplier, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Describes metadata for retrieving price info. + [System.ComponentModel.TypeConverter(typeof(SkuCostTypeConverter))] + public partial interface ISkuCost + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.TypeConverter.cs new file mode 100644 index 00000000000..61fcaac2224 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SkuCostTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCost ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCost).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SkuCost.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SkuCost.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SkuCost.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.cs new file mode 100644 index 00000000000..06782d607d0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Describes metadata for retrieving price info. + public partial class SkuCost : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCost, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal + { + + /// Backing field for property. + private string _meterId; + + /// Meter id of the Sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string MeterId { get => this._meterId; } + + /// Backing field for property. + private string _meterType; + + /// The type of the meter. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string MeterType { get => this._meterType; } + + /// Internal Acessors for MeterId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal.MeterId { get => this._meterId; set { {_meterId = value;} } } + + /// Internal Acessors for MeterType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal.MeterType { get => this._meterType; set { {_meterType = value;} } } + + /// Internal Acessors for Multiplier + double? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCostInternal.Multiplier { get => this._multiplier; set { {_multiplier = value;} } } + + /// Backing field for property. + private double? _multiplier; + + /// + /// Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping + /// guid with appropriate multiplier specific to region. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public double? Multiplier { get => this._multiplier; } + + /// Creates an new instance. + public SkuCost() + { + + } + } + /// Describes metadata for retrieving price info. + public partial interface ISkuCost : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Meter id of the Sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Meter id of the Sku.", + SerializedName = @"meterId", + PossibleTypes = new [] { typeof(string) })] + string MeterId { get; } + /// The type of the meter. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The type of the meter.", + SerializedName = @"meterType", + PossibleTypes = new [] { typeof(string) })] + string MeterType { get; } + /// + /// Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping + /// guid with appropriate multiplier specific to region. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region.", + SerializedName = @"multiplier", + PossibleTypes = new [] { typeof(double) })] + double? Multiplier { get; } + + } + /// Describes metadata for retrieving price info. + internal partial interface ISkuCostInternal + + { + /// Meter id of the Sku. + string MeterId { get; set; } + /// The type of the meter. + string MeterType { get; set; } + /// + /// Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping + /// guid with appropriate multiplier specific to region. + /// + double? Multiplier { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.json.cs new file mode 100644 index 00000000000..0cfb9d4b4a7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuCost.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Describes metadata for retrieving price info. + public partial class SkuCost + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCost. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCost. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCost FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new SkuCost(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal SkuCost(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_meterId = If( json?.PropertyT("meterId"), out var __jsonMeterId) ? (string)__jsonMeterId : (string)_meterId;} + {_meterType = If( json?.PropertyT("meterType"), out var __jsonMeterType) ? (string)__jsonMeterType : (string)_meterType;} + {_multiplier = If( json?.PropertyT("multiplier"), out var __jsonMultiplier) ? (double?)__jsonMultiplier : _multiplier;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._meterId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._meterId.ToString()) : null, "meterId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._meterType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._meterType.ToString()) : null, "meterType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._multiplier ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNumber((double)this._multiplier) : null, "multiplier" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.PowerShell.cs new file mode 100644 index 00000000000..ce5a0a76db6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.PowerShell.cs @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Information of the sku. + [System.ComponentModel.TypeConverter(typeof(SkuInformationTypeConverter))] + public partial class SkuInformation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SkuInformation(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.DataBox.Models.ISkuInformation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SkuInformation(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.DataBox.Models.ISkuInformation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SkuInformation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("SkuDisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuDisplayName = (string) content.GetValueForProperty("SkuDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuDisplayName, global::System.Convert.ToString); + } + if (content.Contains("SkuFamily")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuFamily = (string) content.GetValueForProperty("SkuFamily",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuFamily, global::System.Convert.ToString); + } + if (content.Contains("SkuModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuModel = (string) content.GetValueForProperty("SkuModel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuModel, global::System.Convert.ToString); + } + if (content.Contains("Capacity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Capacity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity) content.GetValueForProperty("Capacity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Capacity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuCapacityTypeConverter.ConvertFrom); + } + if (content.Contains("DataLocationToServiceLocationMap")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).DataLocationToServiceLocationMap = (System.Collections.Generic.List) content.GetValueForProperty("DataLocationToServiceLocationMap",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).DataLocationToServiceLocationMap, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataLocationToServiceLocationMapTypeConverter.ConvertFrom)); + } + if (content.Contains("Cost")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Cost = (System.Collections.Generic.List) content.GetValueForProperty("Cost",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Cost, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuCostTypeConverter.ConvertFrom)); + } + if (content.Contains("ApiVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).ApiVersion = (System.Collections.Generic.List) content.GetValueForProperty("ApiVersion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).ApiVersion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DisabledReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).DisabledReason = (string) content.GetValueForProperty("DisabledReason",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).DisabledReason, global::System.Convert.ToString); + } + if (content.Contains("DisabledReasonMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).DisabledReasonMessage = (string) content.GetValueForProperty("DisabledReasonMessage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).DisabledReasonMessage, global::System.Convert.ToString); + } + if (content.Contains("RequiredFeature")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).RequiredFeature = (string) content.GetValueForProperty("RequiredFeature",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).RequiredFeature, global::System.Convert.ToString); + } + if (content.Contains("CountriesWithinCommerceBoundary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CountriesWithinCommerceBoundary = (System.Collections.Generic.List) content.GetValueForProperty("CountriesWithinCommerceBoundary",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CountriesWithinCommerceBoundary, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("CapacityUsable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CapacityUsable = (string) content.GetValueForProperty("CapacityUsable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CapacityUsable, global::System.Convert.ToString); + } + if (content.Contains("CapacityMaximum")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CapacityMaximum = (string) content.GetValueForProperty("CapacityMaximum",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CapacityMaximum, global::System.Convert.ToString); + } + if (content.Contains("CapacityIndividualSkuUsable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CapacityIndividualSkuUsable = (string) content.GetValueForProperty("CapacityIndividualSkuUsable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CapacityIndividualSkuUsable, 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 SkuInformation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("SkuDisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuDisplayName = (string) content.GetValueForProperty("SkuDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuDisplayName, global::System.Convert.ToString); + } + if (content.Contains("SkuFamily")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuFamily = (string) content.GetValueForProperty("SkuFamily",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuFamily, global::System.Convert.ToString); + } + if (content.Contains("SkuModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuModel = (string) content.GetValueForProperty("SkuModel",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).SkuModel, global::System.Convert.ToString); + } + if (content.Contains("Capacity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Capacity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity) content.GetValueForProperty("Capacity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Capacity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuCapacityTypeConverter.ConvertFrom); + } + if (content.Contains("DataLocationToServiceLocationMap")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).DataLocationToServiceLocationMap = (System.Collections.Generic.List) content.GetValueForProperty("DataLocationToServiceLocationMap",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).DataLocationToServiceLocationMap, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataLocationToServiceLocationMapTypeConverter.ConvertFrom)); + } + if (content.Contains("Cost")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Cost = (System.Collections.Generic.List) content.GetValueForProperty("Cost",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).Cost, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuCostTypeConverter.ConvertFrom)); + } + if (content.Contains("ApiVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).ApiVersion = (System.Collections.Generic.List) content.GetValueForProperty("ApiVersion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).ApiVersion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DisabledReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).DisabledReason = (string) content.GetValueForProperty("DisabledReason",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).DisabledReason, global::System.Convert.ToString); + } + if (content.Contains("DisabledReasonMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).DisabledReasonMessage = (string) content.GetValueForProperty("DisabledReasonMessage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).DisabledReasonMessage, global::System.Convert.ToString); + } + if (content.Contains("RequiredFeature")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).RequiredFeature = (string) content.GetValueForProperty("RequiredFeature",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).RequiredFeature, global::System.Convert.ToString); + } + if (content.Contains("CountriesWithinCommerceBoundary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CountriesWithinCommerceBoundary = (System.Collections.Generic.List) content.GetValueForProperty("CountriesWithinCommerceBoundary",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CountriesWithinCommerceBoundary, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("CapacityUsable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CapacityUsable = (string) content.GetValueForProperty("CapacityUsable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CapacityUsable, global::System.Convert.ToString); + } + if (content.Contains("CapacityMaximum")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CapacityMaximum = (string) content.GetValueForProperty("CapacityMaximum",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CapacityMaximum, global::System.Convert.ToString); + } + if (content.Contains("CapacityIndividualSkuUsable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CapacityIndividualSkuUsable = (string) content.GetValueForProperty("CapacityIndividualSkuUsable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal)this).CapacityIndividualSkuUsable, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Information of the sku. + [System.ComponentModel.TypeConverter(typeof(SkuInformationTypeConverter))] + public partial interface ISkuInformation + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.TypeConverter.cs new file mode 100644 index 00000000000..388ab44f851 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SkuInformationTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SkuInformation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SkuInformation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SkuInformation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.cs new file mode 100644 index 00000000000..534a0fb0138 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.cs @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Information of the sku. + public partial class SkuInformation : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformation, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal + { + + /// Api versions that support this Sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List ApiVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).ApiVersion; } + + /// Maximum capacity per device in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string CapacityIndividualSkuUsable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).CapacityIndividualSkuUsable; } + + /// Maximum capacity in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string CapacityMaximum { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).CapacityMaximum; } + + /// Usable capacity in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string CapacityUsable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).CapacityUsable; } + + /// Cost of the Sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Cost { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).Cost; } + + /// List of all the Countries in the SKU specific commerce boundary + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List CountriesWithinCommerceBoundary { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).CountriesWithinCommerceBoundary; } + + /// The map of data location to service location. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List DataLocationToServiceLocationMap { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).DataLocationToServiceLocationMap; } + + /// Reason why the Sku is disabled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DisabledReason { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).DisabledReason; } + + /// Message for why the Sku is disabled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DisabledReasonMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).DisabledReasonMessage; } + + /// Backing field for property. + private bool? _enabled; + + /// The sku is enabled or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? Enabled { get => this._enabled; } + + /// Internal Acessors for ApiVersion + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.ApiVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).ApiVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).ApiVersion = value ?? null /* arrayOf */; } + + /// Internal Acessors for Capacity + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.Capacity { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).Capacity; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).Capacity = value ?? null /* model class */; } + + /// Internal Acessors for CapacityIndividualSkuUsable + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.CapacityIndividualSkuUsable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).CapacityIndividualSkuUsable; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).CapacityIndividualSkuUsable = value ?? null; } + + /// Internal Acessors for CapacityMaximum + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.CapacityMaximum { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).CapacityMaximum; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).CapacityMaximum = value ?? null; } + + /// Internal Acessors for CapacityUsable + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.CapacityUsable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).CapacityUsable; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).CapacityUsable = value ?? null; } + + /// Internal Acessors for Cost + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.Cost { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).Cost; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).Cost = value ?? null /* arrayOf */; } + + /// Internal Acessors for CountriesWithinCommerceBoundary + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.CountriesWithinCommerceBoundary { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).CountriesWithinCommerceBoundary; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).CountriesWithinCommerceBoundary = value ?? null /* arrayOf */; } + + /// Internal Acessors for DataLocationToServiceLocationMap + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.DataLocationToServiceLocationMap { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).DataLocationToServiceLocationMap; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).DataLocationToServiceLocationMap = value ?? null /* arrayOf */; } + + /// Internal Acessors for DisabledReason + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.DisabledReason { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).DisabledReason; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).DisabledReason = value ?? null; } + + /// Internal Acessors for DisabledReasonMessage + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.DisabledReasonMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).DisabledReasonMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).DisabledReasonMessage = value ?? null; } + + /// Internal Acessors for Enabled + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.Enabled { get => this._enabled; set { {_enabled = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuProperties()); set { {_property = value;} } } + + /// Internal Acessors for RequiredFeature + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.RequiredFeature { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).RequiredFeature; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).RequiredFeature = value ?? null; } + + /// Internal Acessors for Sku + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Sku()); set { {_sku = value;} } } + + /// Internal Acessors for SkuDisplayName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.SkuDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).DisplayName = value ?? null; } + + /// Internal Acessors for SkuFamily + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.SkuFamily { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Family; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Family = value ?? null; } + + /// Internal Acessors for SkuModel + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.SkuModel { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Model; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Model = value ?? null; } + + /// Internal Acessors for SkuName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformationInternal.SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Name = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties _property; + + /// Properties of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuProperties()); } + + /// Required feature to access the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string RequiredFeature { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)Property).RequiredFeature; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku _sku; + + /// The Sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Sku()); } + + /// The display name of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string SkuDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).DisplayName; } + + /// The sku family. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string SkuFamily { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Family; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string SkuModel { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Model; } + + /// The sku name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInternal)Sku).Name; } + + /// Creates an new instance. + public SkuInformation() + { + + } + } + /// Information of the sku. + public partial interface ISkuInformation : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Api versions that support this Sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Api versions that support this Sku.", + SerializedName = @"apiVersions", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List ApiVersion { get; } + /// Maximum capacity per device in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Maximum capacity per device in TB.", + SerializedName = @"individualSkuUsable", + PossibleTypes = new [] { typeof(string) })] + string CapacityIndividualSkuUsable { get; } + /// Maximum capacity in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Maximum capacity in TB.", + SerializedName = @"maximum", + PossibleTypes = new [] { typeof(string) })] + string CapacityMaximum { get; } + /// Usable capacity in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Usable capacity in TB.", + SerializedName = @"usable", + PossibleTypes = new [] { typeof(string) })] + string CapacityUsable { get; } + /// Cost of the Sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Cost of the Sku.", + SerializedName = @"costs", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCost) })] + System.Collections.Generic.List Cost { get; } + /// List of all the Countries in the SKU specific commerce boundary + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of all the Countries in the SKU specific commerce boundary", + SerializedName = @"countriesWithinCommerceBoundary", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List CountriesWithinCommerceBoundary { get; } + /// The map of data location to service location. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The map of data location to service location.", + SerializedName = @"dataLocationToServiceLocationMap", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMap) })] + System.Collections.Generic.List DataLocationToServiceLocationMap { get; } + /// Reason why the Sku is disabled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Reason why the Sku is disabled.", + SerializedName = @"disabledReason", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Country", "Region", "Feature", "OfferType", "NoSubscriptionInfo")] + string DisabledReason { get; } + /// Message for why the Sku is disabled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Message for why the Sku is disabled.", + SerializedName = @"disabledReasonMessage", + PossibleTypes = new [] { typeof(string) })] + string DisabledReasonMessage { get; } + /// The sku is enabled or not. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The sku is enabled or not.", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; } + /// Required feature to access the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Required feature to access the sku.", + SerializedName = @"requiredFeature", + PossibleTypes = new [] { typeof(string) })] + string RequiredFeature { get; } + /// The display name of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The display name of the sku.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string SkuDisplayName { get; } + /// The sku family. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The sku family.", + SerializedName = @"family", + PossibleTypes = new [] { typeof(string) })] + string SkuFamily { get; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string SkuModel { get; } + /// The sku name. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The sku name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string SkuName { get; } + + } + /// Information of the sku. + internal partial interface ISkuInformationInternal + + { + /// Api versions that support this Sku. + System.Collections.Generic.List ApiVersion { get; set; } + /// Capacity of the Sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity Capacity { get; set; } + /// Maximum capacity per device in TB. + string CapacityIndividualSkuUsable { get; set; } + /// Maximum capacity in TB. + string CapacityMaximum { get; set; } + /// Usable capacity in TB. + string CapacityUsable { get; set; } + /// Cost of the Sku. + System.Collections.Generic.List Cost { get; set; } + /// List of all the Countries in the SKU specific commerce boundary + System.Collections.Generic.List CountriesWithinCommerceBoundary { get; set; } + /// The map of data location to service location. + System.Collections.Generic.List DataLocationToServiceLocationMap { get; set; } + /// Reason why the Sku is disabled. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Country", "Region", "Feature", "OfferType", "NoSubscriptionInfo")] + string DisabledReason { get; set; } + /// Message for why the Sku is disabled. + string DisabledReasonMessage { get; set; } + /// The sku is enabled or not. + bool? Enabled { get; set; } + /// Properties of the sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties Property { get; set; } + /// Required feature to access the sku. + string RequiredFeature { get; set; } + /// The Sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISku Sku { get; set; } + /// The display name of the sku. + string SkuDisplayName { get; set; } + /// The sku family. + string SkuFamily { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string SkuModel { get; set; } + /// The sku name. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string SkuName { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.json.cs new file mode 100644 index 00000000000..a3aab895703 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuInformation.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Information of the sku. + public partial class SkuInformation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformation FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new SkuInformation(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal SkuInformation(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Sku.FromJson(__jsonSku) : _sku;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuProperties.FromJson(__jsonProperties) : _property;} + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._sku ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._sku.ToJson(null,serializationMode) : null, "sku" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.PowerShell.cs new file mode 100644 index 00000000000..160cc57c719 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.PowerShell.cs @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Properties of the sku. + [System.ComponentModel.TypeConverter(typeof(SkuPropertiesTypeConverter))] + public partial class SkuProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SkuProperties(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.DataBox.Models.ISkuProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SkuProperties(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.DataBox.Models.ISkuProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SkuProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Capacity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).Capacity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity) content.GetValueForProperty("Capacity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).Capacity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuCapacityTypeConverter.ConvertFrom); + } + if (content.Contains("DataLocationToServiceLocationMap")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).DataLocationToServiceLocationMap = (System.Collections.Generic.List) content.GetValueForProperty("DataLocationToServiceLocationMap",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).DataLocationToServiceLocationMap, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataLocationToServiceLocationMapTypeConverter.ConvertFrom)); + } + if (content.Contains("Cost")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).Cost = (System.Collections.Generic.List) content.GetValueForProperty("Cost",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).Cost, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuCostTypeConverter.ConvertFrom)); + } + if (content.Contains("ApiVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).ApiVersion = (System.Collections.Generic.List) content.GetValueForProperty("ApiVersion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).ApiVersion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DisabledReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).DisabledReason = (string) content.GetValueForProperty("DisabledReason",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).DisabledReason, global::System.Convert.ToString); + } + if (content.Contains("DisabledReasonMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).DisabledReasonMessage = (string) content.GetValueForProperty("DisabledReasonMessage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).DisabledReasonMessage, global::System.Convert.ToString); + } + if (content.Contains("RequiredFeature")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).RequiredFeature = (string) content.GetValueForProperty("RequiredFeature",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).RequiredFeature, global::System.Convert.ToString); + } + if (content.Contains("CountriesWithinCommerceBoundary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CountriesWithinCommerceBoundary = (System.Collections.Generic.List) content.GetValueForProperty("CountriesWithinCommerceBoundary",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CountriesWithinCommerceBoundary, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("CapacityUsable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CapacityUsable = (string) content.GetValueForProperty("CapacityUsable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CapacityUsable, global::System.Convert.ToString); + } + if (content.Contains("CapacityMaximum")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CapacityMaximum = (string) content.GetValueForProperty("CapacityMaximum",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CapacityMaximum, global::System.Convert.ToString); + } + if (content.Contains("CapacityIndividualSkuUsable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CapacityIndividualSkuUsable = (string) content.GetValueForProperty("CapacityIndividualSkuUsable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CapacityIndividualSkuUsable, 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 SkuProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Capacity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).Capacity = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity) content.GetValueForProperty("Capacity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).Capacity, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuCapacityTypeConverter.ConvertFrom); + } + if (content.Contains("DataLocationToServiceLocationMap")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).DataLocationToServiceLocationMap = (System.Collections.Generic.List) content.GetValueForProperty("DataLocationToServiceLocationMap",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).DataLocationToServiceLocationMap, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataLocationToServiceLocationMapTypeConverter.ConvertFrom)); + } + if (content.Contains("Cost")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).Cost = (System.Collections.Generic.List) content.GetValueForProperty("Cost",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).Cost, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuCostTypeConverter.ConvertFrom)); + } + if (content.Contains("ApiVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).ApiVersion = (System.Collections.Generic.List) content.GetValueForProperty("ApiVersion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).ApiVersion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("DisabledReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).DisabledReason = (string) content.GetValueForProperty("DisabledReason",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).DisabledReason, global::System.Convert.ToString); + } + if (content.Contains("DisabledReasonMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).DisabledReasonMessage = (string) content.GetValueForProperty("DisabledReasonMessage",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).DisabledReasonMessage, global::System.Convert.ToString); + } + if (content.Contains("RequiredFeature")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).RequiredFeature = (string) content.GetValueForProperty("RequiredFeature",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).RequiredFeature, global::System.Convert.ToString); + } + if (content.Contains("CountriesWithinCommerceBoundary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CountriesWithinCommerceBoundary = (System.Collections.Generic.List) content.GetValueForProperty("CountriesWithinCommerceBoundary",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CountriesWithinCommerceBoundary, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("CapacityUsable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CapacityUsable = (string) content.GetValueForProperty("CapacityUsable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CapacityUsable, global::System.Convert.ToString); + } + if (content.Contains("CapacityMaximum")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CapacityMaximum = (string) content.GetValueForProperty("CapacityMaximum",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CapacityMaximum, global::System.Convert.ToString); + } + if (content.Contains("CapacityIndividualSkuUsable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CapacityIndividualSkuUsable = (string) content.GetValueForProperty("CapacityIndividualSkuUsable",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal)this).CapacityIndividualSkuUsable, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 sku. + [System.ComponentModel.TypeConverter(typeof(SkuPropertiesTypeConverter))] + public partial interface ISkuProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.TypeConverter.cs new file mode 100644 index 00000000000..712e62f5d09 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SkuPropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SkuProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SkuProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SkuProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.cs new file mode 100644 index 00000000000..3c0c66ff493 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.cs @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of the sku. + public partial class SkuProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _apiVersion; + + /// Api versions that support this Sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List ApiVersion { get => this._apiVersion; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity _capacity; + + /// Capacity of the Sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity Capacity { get => (this._capacity = this._capacity ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuCapacity()); } + + /// Maximum capacity per device in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string CapacityIndividualSkuUsable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)Capacity).IndividualSkuUsable; } + + /// Maximum capacity in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string CapacityMaximum { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)Capacity).Maximum; } + + /// Usable capacity in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string CapacityUsable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)Capacity).Usable; } + + /// Backing field for property. + private System.Collections.Generic.List _cost; + + /// Cost of the Sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List Cost { get => this._cost; } + + /// Backing field for property. + private System.Collections.Generic.List _countriesWithinCommerceBoundary; + + /// List of all the Countries in the SKU specific commerce boundary + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List CountriesWithinCommerceBoundary { get => this._countriesWithinCommerceBoundary; } + + /// Backing field for property. + private System.Collections.Generic.List _dataLocationToServiceLocationMap; + + /// The map of data location to service location. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List DataLocationToServiceLocationMap { get => this._dataLocationToServiceLocationMap; } + + /// Backing field for property. + private string _disabledReason; + + /// Reason why the Sku is disabled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DisabledReason { get => this._disabledReason; } + + /// Backing field for property. + private string _disabledReasonMessage; + + /// Message for why the Sku is disabled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DisabledReasonMessage { get => this._disabledReasonMessage; } + + /// Internal Acessors for ApiVersion + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal.ApiVersion { get => this._apiVersion; set { {_apiVersion = value;} } } + + /// Internal Acessors for Capacity + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal.Capacity { get => (this._capacity = this._capacity ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuCapacity()); set { {_capacity = value;} } } + + /// Internal Acessors for CapacityIndividualSkuUsable + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal.CapacityIndividualSkuUsable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)Capacity).IndividualSkuUsable; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)Capacity).IndividualSkuUsable = value ?? null; } + + /// Internal Acessors for CapacityMaximum + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal.CapacityMaximum { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)Capacity).Maximum; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)Capacity).Maximum = value ?? null; } + + /// Internal Acessors for CapacityUsable + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal.CapacityUsable { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)Capacity).Usable; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacityInternal)Capacity).Usable = value ?? null; } + + /// Internal Acessors for Cost + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal.Cost { get => this._cost; set { {_cost = value;} } } + + /// Internal Acessors for CountriesWithinCommerceBoundary + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal.CountriesWithinCommerceBoundary { get => this._countriesWithinCommerceBoundary; set { {_countriesWithinCommerceBoundary = value;} } } + + /// Internal Acessors for DataLocationToServiceLocationMap + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal.DataLocationToServiceLocationMap { get => this._dataLocationToServiceLocationMap; set { {_dataLocationToServiceLocationMap = value;} } } + + /// Internal Acessors for DisabledReason + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal.DisabledReason { get => this._disabledReason; set { {_disabledReason = value;} } } + + /// Internal Acessors for DisabledReasonMessage + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal.DisabledReasonMessage { get => this._disabledReasonMessage; set { {_disabledReasonMessage = value;} } } + + /// Internal Acessors for RequiredFeature + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuPropertiesInternal.RequiredFeature { get => this._requiredFeature; set { {_requiredFeature = value;} } } + + /// Backing field for property. + private string _requiredFeature; + + /// Required feature to access the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string RequiredFeature { get => this._requiredFeature; } + + /// Creates an new instance. + public SkuProperties() + { + + } + } + /// Properties of the sku. + public partial interface ISkuProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Api versions that support this Sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Api versions that support this Sku.", + SerializedName = @"apiVersions", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List ApiVersion { get; } + /// Maximum capacity per device in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Maximum capacity per device in TB.", + SerializedName = @"individualSkuUsable", + PossibleTypes = new [] { typeof(string) })] + string CapacityIndividualSkuUsable { get; } + /// Maximum capacity in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Maximum capacity in TB.", + SerializedName = @"maximum", + PossibleTypes = new [] { typeof(string) })] + string CapacityMaximum { get; } + /// Usable capacity in TB. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Usable capacity in TB.", + SerializedName = @"usable", + PossibleTypes = new [] { typeof(string) })] + string CapacityUsable { get; } + /// Cost of the Sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Cost of the Sku.", + SerializedName = @"costs", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCost) })] + System.Collections.Generic.List Cost { get; } + /// List of all the Countries in the SKU specific commerce boundary + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of all the Countries in the SKU specific commerce boundary", + SerializedName = @"countriesWithinCommerceBoundary", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List CountriesWithinCommerceBoundary { get; } + /// The map of data location to service location. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The map of data location to service location.", + SerializedName = @"dataLocationToServiceLocationMap", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataLocationToServiceLocationMap) })] + System.Collections.Generic.List DataLocationToServiceLocationMap { get; } + /// Reason why the Sku is disabled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Reason why the Sku is disabled.", + SerializedName = @"disabledReason", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Country", "Region", "Feature", "OfferType", "NoSubscriptionInfo")] + string DisabledReason { get; } + /// Message for why the Sku is disabled. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Message for why the Sku is disabled.", + SerializedName = @"disabledReasonMessage", + PossibleTypes = new [] { typeof(string) })] + string DisabledReasonMessage { get; } + /// Required feature to access the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Required feature to access the sku.", + SerializedName = @"requiredFeature", + PossibleTypes = new [] { typeof(string) })] + string RequiredFeature { get; } + + } + /// Properties of the sku. + internal partial interface ISkuPropertiesInternal + + { + /// Api versions that support this Sku. + System.Collections.Generic.List ApiVersion { get; set; } + /// Capacity of the Sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuCapacity Capacity { get; set; } + /// Maximum capacity per device in TB. + string CapacityIndividualSkuUsable { get; set; } + /// Maximum capacity in TB. + string CapacityMaximum { get; set; } + /// Usable capacity in TB. + string CapacityUsable { get; set; } + /// Cost of the Sku. + System.Collections.Generic.List Cost { get; set; } + /// List of all the Countries in the SKU specific commerce boundary + System.Collections.Generic.List CountriesWithinCommerceBoundary { get; set; } + /// The map of data location to service location. + System.Collections.Generic.List DataLocationToServiceLocationMap { get; set; } + /// Reason why the Sku is disabled. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Country", "Region", "Feature", "OfferType", "NoSubscriptionInfo")] + string DisabledReason { get; set; } + /// Message for why the Sku is disabled. + string DisabledReasonMessage { get; set; } + /// Required feature to access the sku. + string RequiredFeature { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.json.cs new file mode 100644 index 00000000000..4a64f01f5e7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SkuProperties.json.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of the sku. + public partial class SkuProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new SkuProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal SkuProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_capacity = If( json?.PropertyT("capacity"), out var __jsonCapacity) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuCapacity.FromJson(__jsonCapacity) : _capacity;} + {_dataLocationToServiceLocationMap = If( json?.PropertyT("dataLocationToServiceLocationMap"), out var __jsonDataLocationToServiceLocationMap) ? If( __jsonDataLocationToServiceLocationMap as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IDataLocationToServiceLocationMap) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataLocationToServiceLocationMap.FromJson(__u) )) ))() : null : _dataLocationToServiceLocationMap;} + {_cost = If( json?.PropertyT("costs"), out var __jsonCosts) ? If( __jsonCosts as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.ISkuCost) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SkuCost.FromJson(__p) )) ))() : null : _cost;} + {_apiVersion = If( json?.PropertyT("apiVersions"), out var __jsonApiVersions) ? If( __jsonApiVersions as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __l) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__l, (__k)=>(string) (__k is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString __j ? (string)(__j.ToString()) : null)) ))() : null : _apiVersion;} + {_disabledReason = If( json?.PropertyT("disabledReason"), out var __jsonDisabledReason) ? (string)__jsonDisabledReason : (string)_disabledReason;} + {_disabledReasonMessage = If( json?.PropertyT("disabledReasonMessage"), out var __jsonDisabledReasonMessage) ? (string)__jsonDisabledReasonMessage : (string)_disabledReasonMessage;} + {_requiredFeature = If( json?.PropertyT("requiredFeature"), out var __jsonRequiredFeature) ? (string)__jsonRequiredFeature : (string)_requiredFeature;} + {_countriesWithinCommerceBoundary = If( json?.PropertyT("countriesWithinCommerceBoundary"), out var __jsonCountriesWithinCommerceBoundary) ? If( __jsonCountriesWithinCommerceBoundary as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonArray, out var __g) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__g, (__f)=>(string) (__f is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString __e ? (string)(__e.ToString()) : null)) ))() : null : _countriesWithinCommerceBoundary;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._capacity ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._capacity.ToJson(null,serializationMode) : null, "capacity" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._dataLocationToServiceLocationMap) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._dataLocationToServiceLocationMap ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("dataLocationToServiceLocationMap",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._cost) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __s in this._cost ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("costs",__r); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._apiVersion) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __n in this._apiVersion ) + { + AddIf(null != (((object)__n)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__n.ToString()) : null ,__m.Add); + } + container.Add("apiVersions",__m); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._disabledReason)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._disabledReason.ToString()) : null, "disabledReason" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._disabledReasonMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._disabledReasonMessage.ToString()) : null, "disabledReasonMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._requiredFeature)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._requiredFeature.ToString()) : null, "requiredFeature" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._countriesWithinCommerceBoundary) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __i in this._countriesWithinCommerceBoundary ) + { + AddIf(null != (((object)__i)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(__i.ToString()) : null ,__h.Add); + } + container.Add("countriesWithinCommerceBoundary",__h); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.PowerShell.cs new file mode 100644 index 00000000000..27dee43a209 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Details for the storage account. + [System.ComponentModel.TypeConverter(typeof(StorageAccountDetailsTypeConverter))] + public partial class StorageAccountDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IStorageAccountDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageAccountDetails(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.DataBox.Models.IStorageAccountDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageAccountDetails(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.DataBox.Models.IStorageAccountDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageAccountDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IStorageAccountDetailsInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IStorageAccountDetailsInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("SharePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).SharePassword = (System.Security.SecureString) content.GetValueForProperty("SharePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).SharePassword, (object ss) => (System.Security.SecureString)ss); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageAccountDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IStorageAccountDetailsInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IStorageAccountDetailsInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("SharePassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).SharePassword = (System.Security.SecureString) content.GetValueForProperty("SharePassword",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)this).SharePassword, (object ss) => (System.Security.SecureString)ss); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Details for the storage account. + [System.ComponentModel.TypeConverter(typeof(StorageAccountDetailsTypeConverter))] + public partial interface IStorageAccountDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.TypeConverter.cs new file mode 100644 index 00000000000..47161a6ea22 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageAccountDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IStorageAccountDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IStorageAccountDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageAccountDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageAccountDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageAccountDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.cs new file mode 100644 index 00000000000..712c0beab02 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details for the storage account. + public partial class StorageAccountDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IStorageAccountDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IStorageAccountDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails __dataAccountDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetails(); + + /// Account Type of the data to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string DataAccountType { get => "StorageAccount"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)__dataAccountDetails).DataAccountType = "StorageAccount"; } + + /// + /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If + /// this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements + /// : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one + /// number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, + /// numbers and these characters : @#\-$%^!+=;:_()]+ + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Security.SecureString SharePassword { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)__dataAccountDetails).SharePassword; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal)__dataAccountDetails).SharePassword = value ?? null; } + + /// Backing field for property. + private string _storageAccountId; + + /// Storage Account Resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string StorageAccountId { get => this._storageAccountId; set => this._storageAccountId = value; } + + /// Creates an new instance. + public StorageAccountDetails() + { + this.__dataAccountDetails.DataAccountType = "StorageAccount"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__dataAccountDetails), __dataAccountDetails); + await eventListener.AssertObjectIsValid(nameof(__dataAccountDetails), __dataAccountDetails); + } + } + /// Details for the storage account. + public partial interface IStorageAccountDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetails + { + /// Storage Account Resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Storage Account Resource Id.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; set; } + + } + /// Details for the storage account. + internal partial interface IStorageAccountDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataAccountDetailsInternal + { + /// Storage Account Resource Id. + string StorageAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.json.cs new file mode 100644 index 00000000000..5aad514824b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/StorageAccountDetails.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details for the storage account. + public partial class StorageAccountDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IStorageAccountDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IStorageAccountDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IStorageAccountDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new StorageAccountDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal StorageAccountDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __dataAccountDetails = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DataAccountDetails(json); + {_storageAccountId = If( json?.PropertyT("storageAccountId"), out var __jsonStorageAccountId) ? (string)__jsonStorageAccountId : (string)_storageAccountId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __dataAccountDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._storageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._storageAccountId.ToString()) : null, "storageAccountId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.PowerShell.cs new file mode 100644 index 00000000000..a212d99ac9e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.PowerShell.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request to validate subscription permission to create jobs. + [System.ComponentModel.TypeConverter(typeof(SubscriptionIsAllowedToCreateJobValidationRequestTypeConverter))] + public partial class SubscriptionIsAllowedToCreateJobValidationRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SubscriptionIsAllowedToCreateJobValidationRequest(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.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SubscriptionIsAllowedToCreateJobValidationRequest(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.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SubscriptionIsAllowedToCreateJobValidationRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, 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 SubscriptionIsAllowedToCreateJobValidationRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + } + } + /// Request to validate subscription permission to create jobs. + [System.ComponentModel.TypeConverter(typeof(SubscriptionIsAllowedToCreateJobValidationRequestTypeConverter))] + public partial interface ISubscriptionIsAllowedToCreateJobValidationRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.TypeConverter.cs new file mode 100644 index 00000000000..4dc455eb917 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubscriptionIsAllowedToCreateJobValidationRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SubscriptionIsAllowedToCreateJobValidationRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SubscriptionIsAllowedToCreateJobValidationRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SubscriptionIsAllowedToCreateJobValidationRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.cs new file mode 100644 index 00000000000..e3ac906c241 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request to validate subscription permission to create jobs. + public partial class SubscriptionIsAllowedToCreateJobValidationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequestInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest __validationInputRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest(); + + /// Identifies the type of validation request. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationType { get => "ValidateSubscriptionIsAllowedToCreateJob"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)__validationInputRequest).ValidationType = "ValidateSubscriptionIsAllowedToCreateJob"; } + + /// + /// Creates an new instance. + /// + public SubscriptionIsAllowedToCreateJobValidationRequest() + { + this.__validationInputRequest.ValidationType = "ValidateSubscriptionIsAllowedToCreateJob"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationInputRequest), __validationInputRequest); + await eventListener.AssertObjectIsValid(nameof(__validationInputRequest), __validationInputRequest); + } + } + /// Request to validate subscription permission to create jobs. + public partial interface ISubscriptionIsAllowedToCreateJobValidationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest + { + + } + /// Request to validate subscription permission to create jobs. + internal partial interface ISubscriptionIsAllowedToCreateJobValidationRequestInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.json.cs new file mode 100644 index 00000000000..06e323d2a41 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationRequest.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request to validate subscription permission to create jobs. + public partial class SubscriptionIsAllowedToCreateJobValidationRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new SubscriptionIsAllowedToCreateJobValidationRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal SubscriptionIsAllowedToCreateJobValidationRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationInputRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest(json); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationInputRequest?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.PowerShell.cs new file mode 100644 index 00000000000..7c89a617f2e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.PowerShell.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Properties of subscription permission to create job validation response. + [System.ComponentModel.TypeConverter(typeof(SubscriptionIsAllowedToCreateJobValidationResponsePropertiesTypeConverter))] + public partial class SubscriptionIsAllowedToCreateJobValidationResponseProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponseProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SubscriptionIsAllowedToCreateJobValidationResponseProperties(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.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponseProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SubscriptionIsAllowedToCreateJobValidationResponseProperties(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.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponseProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SubscriptionIsAllowedToCreateJobValidationResponseProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponsePropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponsePropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, 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 SubscriptionIsAllowedToCreateJobValidationResponseProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponsePropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponsePropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 subscription permission to create job validation response. + [System.ComponentModel.TypeConverter(typeof(SubscriptionIsAllowedToCreateJobValidationResponsePropertiesTypeConverter))] + public partial interface ISubscriptionIsAllowedToCreateJobValidationResponseProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.TypeConverter.cs new file mode 100644 index 00000000000..955428a393f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubscriptionIsAllowedToCreateJobValidationResponsePropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponseProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponseProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SubscriptionIsAllowedToCreateJobValidationResponseProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SubscriptionIsAllowedToCreateJobValidationResponseProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SubscriptionIsAllowedToCreateJobValidationResponseProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.cs new file mode 100644 index 00000000000..a47b76c61d3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of subscription permission to create job validation response. + public partial class SubscriptionIsAllowedToCreateJobValidationResponseProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponseProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponsePropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse __validationInputResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse(); + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail; } + + /// Error code and message of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error = value ?? null /* model class */; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message; } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponsePropertiesInternal.Status { get => this._status; set { {_status = value;} } } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Code = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Error = value ?? null /* model class */; } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target = value ?? null; } + + /// Backing field for property. + private string _status; + + /// Validation status of subscription permission to create job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Status { get => this._status; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).Target; } + + /// Identifies the type of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationType { get => "ValidateSubscriptionIsAllowedToCreateJob"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)__validationInputResponse).ValidationType = "ValidateSubscriptionIsAllowedToCreateJob"; } + + /// + /// Creates an new instance. + /// + public SubscriptionIsAllowedToCreateJobValidationResponseProperties() + { + this.__validationInputResponse.ValidationType = "ValidateSubscriptionIsAllowedToCreateJob"; + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationInputResponse), __validationInputResponse); + await eventListener.AssertObjectIsValid(nameof(__validationInputResponse), __validationInputResponse); + } + } + /// Properties of subscription permission to create job validation response. + public partial interface ISubscriptionIsAllowedToCreateJobValidationResponseProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse + { + /// Validation status of subscription permission to create job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Validation status of subscription permission to create job.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Skipped")] + string Status { get; } + + } + /// Properties of subscription permission to create job validation response. + internal partial interface ISubscriptionIsAllowedToCreateJobValidationResponsePropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal + { + /// Validation status of subscription permission to create job. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Valid", "Invalid", "Skipped")] + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.json.cs new file mode 100644 index 00000000000..25f381b7f86 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SubscriptionIsAllowedToCreateJobValidationResponseProperties.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of subscription permission to create job validation response. + public partial class SubscriptionIsAllowedToCreateJobValidationResponseProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponseProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponseProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationResponseProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new SubscriptionIsAllowedToCreateJobValidationResponseProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal SubscriptionIsAllowedToCreateJobValidationResponseProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationInputResponse = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse(json); + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationInputResponse?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.PowerShell.cs new file mode 100644 index 00000000000..65ee46f874a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Metadata pertaining to creation and last modification of the resource. + [System.ComponentModel.TypeConverter(typeof(SystemDataTypeConverter))] + public partial class SystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SystemData(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.DataBox.Models.ISystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SystemData(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.DataBox.Models.ISystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 the resource. + [System.ComponentModel.TypeConverter(typeof(SystemDataTypeConverter))] + public partial interface ISystemData + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.TypeConverter.cs new file mode 100644 index 00000000000..a371373b797 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.TypeConverter.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SystemDataTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.cs new file mode 100644 index 00000000000..79a68f36c89 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Metadata pertaining to creation and last modification of the resource. + public partial class SystemData : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemDataInternal + { + + /// Backing field for property. + private global::System.DateTime? _createdAt; + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public global::System.DateTime? CreatedAt { get => this._createdAt; set => this._createdAt = value; } + + /// Backing field for property. + private string _createdBy; + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CreatedBy { get => this._createdBy; set => this._createdBy = value; } + + /// Backing field for property. + private string _createdByType; + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string CreatedByType { get => this._createdByType; set => this._createdByType = value; } + + /// Backing field for property. + private global::System.DateTime? _lastModifiedAt; + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public global::System.DateTime? LastModifiedAt { get => this._lastModifiedAt; set => this._lastModifiedAt = value; } + + /// Backing field for property. + private string _lastModifiedBy; + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string LastModifiedBy { get => this._lastModifiedBy; set => this._lastModifiedBy = value; } + + /// Backing field for property. + private string _lastModifiedByType; + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string LastModifiedByType { get => this._lastModifiedByType; set => this._lastModifiedByType = value; } + + /// Creates an new instance. + public SystemData() + { + + } + } + /// Metadata pertaining to creation and last modification of the resource. + public partial interface ISystemData : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.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) })] + global::System.DateTime? CreatedAt { get; set; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string CreatedBy { get; set; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.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) })] + global::System.DateTime? LastModifiedAt { get; set; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string LastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } + + } + /// Metadata pertaining to creation and last modification of the resource. + internal partial interface ISystemDataInternal + + { + /// The timestamp of resource creation (UTC). + global::System.DateTime? CreatedAt { get; set; } + /// The identity that created the resource. + string CreatedBy { get; set; } + /// The type of identity that created the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? LastModifiedAt { get; set; } + /// The identity that last modified the resource. + string LastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.json.cs new file mode 100644 index 00000000000..8b0fa9d8039 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/SystemData.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Metadata pertaining to creation and last modification of the resource. + public partial class SystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData. + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new SystemData(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal SystemData(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + 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;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._createdBy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._createdBy.ToString()) : null, "createdBy" ,container.Add ); + AddIf( null != (((object)this._createdByType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._createdByType.ToString()) : null, "createdByType" ,container.Add ); + AddIf( null != this._createdAt ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._createdAt?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "createdAt" ,container.Add ); + AddIf( null != (((object)this._lastModifiedBy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._lastModifiedBy.ToString()) : null, "lastModifiedBy" ,container.Add ); + AddIf( null != (((object)this._lastModifiedByType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._lastModifiedByType.ToString()) : null, "lastModifiedByType" ,container.Add ); + AddIf( null != this._lastModifiedAt ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._lastModifiedAt?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastModifiedAt" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.PowerShell.cs new file mode 100644 index 00000000000..e4383012051 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.PowerShell.cs @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + /// + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTypeConverter))] + public partial class TrackedResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TrackedResource(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.DataBox.Models.ITrackedResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TrackedResource(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.DataBox.Models.ITrackedResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TrackedResource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Type, 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 TrackedResource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTypeConverter))] + public partial interface ITrackedResource + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.TypeConverter.cs new file mode 100644 index 00000000000..bf686c84249 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TrackedResourceTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TrackedResource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TrackedResource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TrackedResource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.cs new file mode 100644 index 00000000000..d659a869777 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + /// + public partial class TrackedResource : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResource, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Resource(); + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).Id; } + + /// Backing field for property. + private string _location; + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).Id = value ?? null; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).Name = value ?? null; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemData = value ?? null /* model class */; } + + /// Internal Acessors for SystemDataCreatedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// Internal Acessors for SystemDataCreatedBy + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + + /// Internal Acessors for SystemDataCreatedByType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataCreatedByType = value ?? null; } + + /// Internal Acessors for SystemDataLastModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// Internal Acessors for SystemDataLastModifiedBy + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + + /// Internal Acessors for SystemDataLastModifiedByType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? null; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).Type = value ?? null; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).Name; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemData = value ?? null /* model class */; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataCreatedAt; } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataCreatedBy; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataCreatedByType; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataLastModifiedAt; } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataLastModifiedBy; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).SystemDataLastModifiedByType; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags _tag; + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TrackedResourceTags()); set => this._tag = value; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public TrackedResource() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + public partial interface ITrackedResource : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResource + { + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags Tag { get; set; } + + } + /// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + internal partial interface ITrackedResourceInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IResourceInternal + { + /// The geo-location where the resource lives + string Location { get; set; } + /// Resource tags. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.json.cs new file mode 100644 index 00000000000..e07c0522187 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResource.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + /// + public partial class TrackedResource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new TrackedResource(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal TrackedResource(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Resource(json); + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TrackedResourceTags.FromJson(__jsonTags) : _tag;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)_location;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.PowerShell.cs new file mode 100644 index 00000000000..01bcd1b282b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.PowerShell.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Resource tags. + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTagsTypeConverter))] + public partial class TrackedResourceTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TrackedResourceTags(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.DataBox.Models.ITrackedResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TrackedResourceTags(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.DataBox.Models.ITrackedResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TrackedResourceTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TrackedResourceTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// Resource tags. + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTagsTypeConverter))] + public partial interface ITrackedResourceTags + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.TypeConverter.cs new file mode 100644 index 00000000000..5e755748f1f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TrackedResourceTagsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TrackedResourceTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TrackedResourceTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TrackedResourceTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.cs new file mode 100644 index 00000000000..62f68c4c691 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Resource tags. + public partial class TrackedResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTagsInternal + { + + /// Creates an new instance. + public TrackedResourceTags() + { + + } + } + /// Resource tags. + public partial interface ITrackedResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + + } + /// Resource tags. + internal partial interface ITrackedResourceTagsInternal + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.dictionary.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.dictionary.cs new file mode 100644 index 00000000000..ac73adf3814 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.dictionary.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public partial class TrackedResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TrackedResourceTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.json.cs new file mode 100644 index 00000000000..0eaccf0599d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TrackedResourceTags.json.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Resource tags. + public partial class TrackedResourceTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new TrackedResourceTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + /// + internal TrackedResourceTags(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.PowerShell.cs new file mode 100644 index 00000000000..d5fa84be623 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Details to transfer all data. + [System.ComponentModel.TypeConverter(typeof(TransferAllDetailsTypeConverter))] + public partial class TransferAllDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransferAllDetails(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.DataBox.Models.ITransferAllDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransferAllDetails(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.DataBox.Models.ITransferAllDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransferAllDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("TransferAllBlob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)this).TransferAllBlob = (bool?) content.GetValueForProperty("TransferAllBlob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)this).TransferAllBlob, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TransferAllFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)this).TransferAllFile = (bool?) content.GetValueForProperty("TransferAllFile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)this).TransferAllFile, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransferAllDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("TransferAllBlob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)this).TransferAllBlob = (bool?) content.GetValueForProperty("TransferAllBlob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)this).TransferAllBlob, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TransferAllFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)this).TransferAllFile = (bool?) content.GetValueForProperty("TransferAllFile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)this).TransferAllFile, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + } + /// Details to transfer all data. + [System.ComponentModel.TypeConverter(typeof(TransferAllDetailsTypeConverter))] + public partial interface ITransferAllDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.TypeConverter.cs new file mode 100644 index 00000000000..d6e5ec87ef3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransferAllDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransferAllDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransferAllDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransferAllDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.cs new file mode 100644 index 00000000000..5d37bbf4e75 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details to transfer all data. + public partial class TransferAllDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal + { + + /// Backing field for property. + private string _dataAccountType; + + /// Type of the account of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DataAccountType { get => this._dataAccountType; set => this._dataAccountType = value; } + + /// Backing field for property. + private bool? _transferAllBlob; + + /// To indicate if all Azure blobs have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? TransferAllBlob { get => this._transferAllBlob; set => this._transferAllBlob = value; } + + /// Backing field for property. + private bool? _transferAllFile; + + /// To indicate if all Azure Files have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? TransferAllFile { get => this._transferAllFile; set => this._transferAllFile = value; } + + /// Creates an new instance. + public TransferAllDetails() + { + + } + } + /// Details to transfer all data. + public partial interface ITransferAllDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Type of the account of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the account of data", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string DataAccountType { get; set; } + /// To indicate if all Azure blobs have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"To indicate if all Azure blobs have to be transferred", + SerializedName = @"transferAllBlobs", + PossibleTypes = new [] { typeof(bool) })] + bool? TransferAllBlob { get; set; } + /// To indicate if all Azure Files have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"To indicate if all Azure Files have to be transferred", + SerializedName = @"transferAllFiles", + PossibleTypes = new [] { typeof(bool) })] + bool? TransferAllFile { get; set; } + + } + /// Details to transfer all data. + internal partial interface ITransferAllDetailsInternal + + { + /// Type of the account of data + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string DataAccountType { get; set; } + /// To indicate if all Azure blobs have to be transferred + bool? TransferAllBlob { get; set; } + /// To indicate if all Azure Files have to be transferred + bool? TransferAllFile { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.json.cs new file mode 100644 index 00000000000..ecf0e37c528 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferAllDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details to transfer all data. + public partial class TransferAllDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new TransferAllDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._dataAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._dataAccountType.ToString()) : null, "dataAccountType" ,container.Add ); + AddIf( null != this._transferAllBlob ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._transferAllBlob) : null, "transferAllBlobs" ,container.Add ); + AddIf( null != this._transferAllFile ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._transferAllFile) : null, "transferAllFiles" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal TransferAllDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_dataAccountType = If( json?.PropertyT("dataAccountType"), out var __jsonDataAccountType) ? (string)__jsonDataAccountType : (string)_dataAccountType;} + {_transferAllBlob = If( json?.PropertyT("transferAllBlobs"), out var __jsonTransferAllBlobs) ? (bool?)__jsonTransferAllBlobs : _transferAllBlob;} + {_transferAllFile = If( json?.PropertyT("transferAllFiles"), out var __jsonTransferAllFiles) ? (bool?)__jsonTransferAllFiles : _transferAllFile;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.PowerShell.cs new file mode 100644 index 00000000000..ec29ab825e0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.PowerShell.cs @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Configuration for defining the transfer of data. + [System.ComponentModel.TypeConverter(typeof(TransferConfigurationTypeConverter))] + public partial class TransferConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransferConfiguration(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.DataBox.Models.ITransferConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransferConfiguration(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.DataBox.Models.ITransferConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransferConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TransferFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails) content.GetValueForProperty("TransferFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferAllDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferAllDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails) content.GetValueForProperty("TransferAllDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferAllDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferAllDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("TransferFilterDetailInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferFilterDetailInclude = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails) content.GetValueForProperty("TransferFilterDetailInclude",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferFilterDetailInclude, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferAllDetailInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferAllDetailInclude = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails) content.GetValueForProperty("TransferAllDetailInclude",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferAllDetailInclude, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferAllDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeBlobFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeBlobFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails) content.GetValueForProperty("IncludeBlobFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeBlobFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.BlobFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeAzureFileFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeAzureFileFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails) content.GetValueForProperty("IncludeAzureFileFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeAzureFileFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AzureFileFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferFilterDetailsIncludeDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferFilterDetailsIncludeDataAccountType = (string) content.GetValueForProperty("TransferFilterDetailsIncludeDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferFilterDetailsIncludeDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("IncludeFilterFileDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeFilterFileDetail = (System.Collections.Generic.List) content.GetValueForProperty("IncludeFilterFileDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeFilterFileDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.FilterFileDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("TransferAllDetailsIncludeDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferAllDetailsIncludeDataAccountType = (string) content.GetValueForProperty("TransferAllDetailsIncludeDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferAllDetailsIncludeDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("IncludeTransferAllBlob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeTransferAllBlob = (bool?) content.GetValueForProperty("IncludeTransferAllBlob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeTransferAllBlob, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IncludeTransferAllFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeTransferAllFile = (bool?) content.GetValueForProperty("IncludeTransferAllFile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeTransferAllFile, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("BlobFilterDetailBlobPrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).BlobFilterDetailBlobPrefixList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).BlobFilterDetailBlobPrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailBlobPathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).BlobFilterDetailBlobPathList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).BlobFilterDetailBlobPathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailContainerList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).BlobFilterDetailContainerList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailContainerList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).BlobFilterDetailContainerList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).AzureFileFilterDetailFilePrefixList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).AzureFileFilterDetailFilePrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).AzureFileFilterDetailFilePathList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).AzureFileFilterDetailFilePathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFileShareList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).AzureFileFilterDetailFileShareList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFileShareList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).AzureFileFilterDetailFileShareList, __y => TypeConverterExtensions.SelectToList(__y, 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 TransferConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TransferFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails) content.GetValueForProperty("TransferFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferAllDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferAllDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails) content.GetValueForProperty("TransferAllDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferAllDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferAllDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("TransferFilterDetailInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferFilterDetailInclude = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails) content.GetValueForProperty("TransferFilterDetailInclude",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferFilterDetailInclude, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferAllDetailInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferAllDetailInclude = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails) content.GetValueForProperty("TransferAllDetailInclude",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferAllDetailInclude, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferAllDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeBlobFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeBlobFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails) content.GetValueForProperty("IncludeBlobFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeBlobFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.BlobFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeAzureFileFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeAzureFileFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails) content.GetValueForProperty("IncludeAzureFileFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeAzureFileFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AzureFileFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TransferFilterDetailsIncludeDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferFilterDetailsIncludeDataAccountType = (string) content.GetValueForProperty("TransferFilterDetailsIncludeDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferFilterDetailsIncludeDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("IncludeFilterFileDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeFilterFileDetail = (System.Collections.Generic.List) content.GetValueForProperty("IncludeFilterFileDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeFilterFileDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.FilterFileDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("TransferAllDetailsIncludeDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferAllDetailsIncludeDataAccountType = (string) content.GetValueForProperty("TransferAllDetailsIncludeDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).TransferAllDetailsIncludeDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("IncludeTransferAllBlob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeTransferAllBlob = (bool?) content.GetValueForProperty("IncludeTransferAllBlob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeTransferAllBlob, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IncludeTransferAllFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeTransferAllFile = (bool?) content.GetValueForProperty("IncludeTransferAllFile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).IncludeTransferAllFile, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("BlobFilterDetailBlobPrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).BlobFilterDetailBlobPrefixList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).BlobFilterDetailBlobPrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailBlobPathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).BlobFilterDetailBlobPathList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).BlobFilterDetailBlobPathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailContainerList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).BlobFilterDetailContainerList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailContainerList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).BlobFilterDetailContainerList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).AzureFileFilterDetailFilePrefixList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).AzureFileFilterDetailFilePrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).AzureFileFilterDetailFilePathList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).AzureFileFilterDetailFilePathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFileShareList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).AzureFileFilterDetailFileShareList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFileShareList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal)this).AzureFileFilterDetailFileShareList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + } + /// Configuration for defining the transfer of data. + [System.ComponentModel.TypeConverter(typeof(TransferConfigurationTypeConverter))] + public partial interface ITransferConfiguration + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.TypeConverter.cs new file mode 100644 index 00000000000..fee77fa672d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransferConfigurationTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransferConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransferConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransferConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.cs new file mode 100644 index 00000000000..c68589179e8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.cs @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Configuration for defining the transfer of data. + public partial class TransferConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal + { + + /// List of full path of the files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AzureFileFilterDetailFilePathList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).AzureFileFilterDetailFilePathList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).AzureFileFilterDetailFilePathList = value ?? null /* arrayOf */; } + + /// Prefix list of the Azure files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AzureFileFilterDetailFilePrefixList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).AzureFileFilterDetailFilePrefixList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).AzureFileFilterDetailFilePrefixList = value ?? null /* arrayOf */; } + + /// List of file shares to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AzureFileFilterDetailFileShareList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).AzureFileFilterDetailFileShareList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).AzureFileFilterDetailFileShareList = value ?? null /* arrayOf */; } + + /// List of full path of the blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List BlobFilterDetailBlobPathList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).BlobFilterDetailBlobPathList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).BlobFilterDetailBlobPathList = value ?? null /* arrayOf */; } + + /// Prefix list of the Azure blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List BlobFilterDetailBlobPrefixList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).BlobFilterDetailBlobPrefixList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).BlobFilterDetailBlobPrefixList = value ?? null /* arrayOf */; } + + /// List of blob containers to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List BlobFilterDetailContainerList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).BlobFilterDetailContainerList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).BlobFilterDetailContainerList = value ?? null /* arrayOf */; } + + /// Details of the filter files to be used for data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List IncludeFilterFileDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).IncludeFilterFileDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).IncludeFilterFileDetail = value ?? null /* arrayOf */; } + + /// To indicate if all Azure blobs have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? IncludeTransferAllBlob { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)TransferAllDetail).IncludeTransferAllBlob; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)TransferAllDetail).IncludeTransferAllBlob = value ?? default(bool); } + + /// To indicate if all Azure Files have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? IncludeTransferAllFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)TransferAllDetail).IncludeTransferAllFile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)TransferAllDetail).IncludeTransferAllFile = value ?? default(bool); } + + /// Internal Acessors for IncludeAzureFileFilterDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal.IncludeAzureFileFilterDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).IncludeAzureFileFilterDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).IncludeAzureFileFilterDetail = value ?? null /* model class */; } + + /// Internal Acessors for IncludeBlobFilterDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal.IncludeBlobFilterDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).IncludeBlobFilterDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).IncludeBlobFilterDetail = value ?? null /* model class */; } + + /// Internal Acessors for TransferAllDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal.TransferAllDetail { get => (this._transferAllDetail = this._transferAllDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferAllDetails()); set { {_transferAllDetail = value;} } } + + /// Internal Acessors for TransferAllDetailInclude + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal.TransferAllDetailInclude { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)TransferAllDetail).Include; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)TransferAllDetail).Include = value ?? null /* model class */; } + + /// Internal Acessors for TransferFilterDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal.TransferFilterDetail { get => (this._transferFilterDetail = this._transferFilterDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferFilterDetails()); set { {_transferFilterDetail = value;} } } + + /// Internal Acessors for TransferFilterDetailInclude + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationInternal.TransferFilterDetailInclude { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).Include; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).Include = value ?? null /* model class */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails _transferAllDetail; + + /// + /// Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType + /// is given as TransferAll + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails TransferAllDetail { get => (this._transferAllDetail = this._transferAllDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferAllDetails()); set => this._transferAllDetail = value; } + + /// Type of the account of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransferAllDetailsIncludeDataAccountType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)TransferAllDetail).IncludeDataAccountType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)TransferAllDetail).IncludeDataAccountType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails _transferFilterDetail; + + /// + /// Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as + /// TransferUsingFilter. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails TransferFilterDetail { get => (this._transferFilterDetail = this._transferFilterDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferFilterDetails()); set => this._transferFilterDetail = value; } + + /// Type of the account of data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransferFilterDetailsIncludeDataAccountType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).IncludeDataAccountType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)TransferFilterDetail).IncludeDataAccountType = value ?? null; } + + /// Backing field for property. + private string _type; + + /// Type of the configuration for transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public TransferConfiguration() + { + + } + } + /// Configuration for defining the transfer of data. + public partial interface ITransferConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// List of full path of the files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of full path of the files to be transferred.", + SerializedName = @"filePathList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AzureFileFilterDetailFilePathList { get; set; } + /// Prefix list of the Azure files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Prefix list of the Azure files to be transferred.", + SerializedName = @"filePrefixList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AzureFileFilterDetailFilePrefixList { get; set; } + /// List of file shares to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of file shares to be transferred.", + SerializedName = @"fileShareList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AzureFileFilterDetailFileShareList { get; set; } + /// List of full path of the blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of full path of the blobs to be transferred.", + SerializedName = @"blobPathList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobFilterDetailBlobPathList { get; set; } + /// Prefix list of the Azure blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Prefix list of the Azure blobs to be transferred.", + SerializedName = @"blobPrefixList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobFilterDetailBlobPrefixList { get; set; } + /// List of blob containers to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of blob containers to be transferred.", + SerializedName = @"containerList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobFilterDetailContainerList { get; set; } + /// Details of the filter files to be used for data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details of the filter files to be used for data transfer.", + SerializedName = @"filterFileDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetails) })] + System.Collections.Generic.List IncludeFilterFileDetail { get; set; } + /// To indicate if all Azure blobs have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"To indicate if all Azure blobs have to be transferred", + SerializedName = @"transferAllBlobs", + PossibleTypes = new [] { typeof(bool) })] + bool? IncludeTransferAllBlob { get; set; } + /// To indicate if all Azure Files have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"To indicate if all Azure Files have to be transferred", + SerializedName = @"transferAllFiles", + PossibleTypes = new [] { typeof(bool) })] + bool? IncludeTransferAllFile { get; set; } + /// Type of the account of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the account of data", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string TransferAllDetailsIncludeDataAccountType { get; set; } + /// Type of the account of data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the account of data.", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string TransferFilterDetailsIncludeDataAccountType { get; set; } + /// Type of the configuration for transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the configuration for transfer.", + SerializedName = @"transferConfigurationType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("TransferAll", "TransferUsingFilter")] + string Type { get; set; } + + } + /// Configuration for defining the transfer of data. + internal partial interface ITransferConfigurationInternal + + { + /// List of full path of the files to be transferred. + System.Collections.Generic.List AzureFileFilterDetailFilePathList { get; set; } + /// Prefix list of the Azure files to be transferred. + System.Collections.Generic.List AzureFileFilterDetailFilePrefixList { get; set; } + /// List of file shares to be transferred. + System.Collections.Generic.List AzureFileFilterDetailFileShareList { get; set; } + /// List of full path of the blobs to be transferred. + System.Collections.Generic.List BlobFilterDetailBlobPathList { get; set; } + /// Prefix list of the Azure blobs to be transferred. + System.Collections.Generic.List BlobFilterDetailBlobPrefixList { get; set; } + /// List of blob containers to be transferred. + System.Collections.Generic.List BlobFilterDetailContainerList { get; set; } + /// Filter details to transfer Azure files. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails IncludeAzureFileFilterDetail { get; set; } + /// Filter details to transfer blobs. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails IncludeBlobFilterDetail { get; set; } + /// Details of the filter files to be used for data transfer. + System.Collections.Generic.List IncludeFilterFileDetail { get; set; } + /// To indicate if all Azure blobs have to be transferred + bool? IncludeTransferAllBlob { get; set; } + /// To indicate if all Azure Files have to be transferred + bool? IncludeTransferAllFile { get; set; } + /// + /// Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType + /// is given as TransferAll + /// + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails TransferAllDetail { get; set; } + /// Details to transfer all data. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails TransferAllDetailInclude { get; set; } + /// Type of the account of data + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string TransferAllDetailsIncludeDataAccountType { get; set; } + /// + /// Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as + /// TransferUsingFilter. + /// + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails TransferFilterDetail { get; set; } + /// Details of the filtering the transfer of data. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails TransferFilterDetailInclude { get; set; } + /// Type of the account of data. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string TransferFilterDetailsIncludeDataAccountType { get; set; } + /// Type of the configuration for transfer. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("TransferAll", "TransferUsingFilter")] + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.json.cs new file mode 100644 index 00000000000..137d5d95629 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfiguration.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Configuration for defining the transfer of data. + public partial class TransferConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new TransferConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._transferFilterDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._transferFilterDetail.ToJson(null,serializationMode) : null, "transferFilterDetails" ,container.Add ); + AddIf( null != this._transferAllDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._transferAllDetail.ToJson(null,serializationMode) : null, "transferAllDetails" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._type.ToString()) : null, "transferConfigurationType" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal TransferConfiguration(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_transferFilterDetail = If( json?.PropertyT("transferFilterDetails"), out var __jsonTransferFilterDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferFilterDetails.FromJson(__jsonTransferFilterDetails) : _transferFilterDetail;} + {_transferAllDetail = If( json?.PropertyT("transferAllDetails"), out var __jsonTransferAllDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferConfigurationTransferAllDetails.FromJson(__jsonTransferAllDetails) : _transferAllDetail;} + {_type = If( json?.PropertyT("transferConfigurationType"), out var __jsonTransferConfigurationType) ? (string)__jsonTransferConfigurationType : (string)_type;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.PowerShell.cs new file mode 100644 index 00000000000..f69a86577d4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.PowerShell.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType + /// is given as TransferAll + /// + [System.ComponentModel.TypeConverter(typeof(TransferConfigurationTransferAllDetailsTypeConverter))] + public partial class TransferConfigurationTransferAllDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransferConfigurationTransferAllDetails(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.DataBox.Models.ITransferConfigurationTransferAllDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransferConfigurationTransferAllDetails(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.DataBox.Models.ITransferConfigurationTransferAllDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransferConfigurationTransferAllDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Include")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).Include = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails) content.GetValueForProperty("Include",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).Include, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferAllDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).IncludeDataAccountType = (string) content.GetValueForProperty("IncludeDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).IncludeDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("IncludeTransferAllBlob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).IncludeTransferAllBlob = (bool?) content.GetValueForProperty("IncludeTransferAllBlob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).IncludeTransferAllBlob, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IncludeTransferAllFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).IncludeTransferAllFile = (bool?) content.GetValueForProperty("IncludeTransferAllFile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).IncludeTransferAllFile, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransferConfigurationTransferAllDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Include")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).Include = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails) content.GetValueForProperty("Include",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).Include, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferAllDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).IncludeDataAccountType = (string) content.GetValueForProperty("IncludeDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).IncludeDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("IncludeTransferAllBlob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).IncludeTransferAllBlob = (bool?) content.GetValueForProperty("IncludeTransferAllBlob",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).IncludeTransferAllBlob, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IncludeTransferAllFile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).IncludeTransferAllFile = (bool?) content.GetValueForProperty("IncludeTransferAllFile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal)this).IncludeTransferAllFile, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + } + /// Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType + /// is given as TransferAll + [System.ComponentModel.TypeConverter(typeof(TransferConfigurationTransferAllDetailsTypeConverter))] + public partial interface ITransferConfigurationTransferAllDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.TypeConverter.cs new file mode 100644 index 00000000000..fd746f2db66 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransferConfigurationTransferAllDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransferConfigurationTransferAllDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransferConfigurationTransferAllDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransferConfigurationTransferAllDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.cs new file mode 100644 index 00000000000..26cb1f459f6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType + /// is given as TransferAll + /// + public partial class TransferConfigurationTransferAllDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails _include; + + /// Details to transfer all data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails Include { get => (this._include = this._include ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferAllDetails()); set => this._include = value; } + + /// Type of the account of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string IncludeDataAccountType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)Include).DataAccountType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)Include).DataAccountType = value ?? null; } + + /// To indicate if all Azure blobs have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? IncludeTransferAllBlob { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)Include).TransferAllBlob; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)Include).TransferAllBlob = value ?? default(bool); } + + /// To indicate if all Azure Files have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? IncludeTransferAllFile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)Include).TransferAllFile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetailsInternal)Include).TransferAllFile = value ?? default(bool); } + + /// Internal Acessors for Include + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetailsInternal.Include { get => (this._include = this._include ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferAllDetails()); set { {_include = value;} } } + + /// Creates an new instance. + public TransferConfigurationTransferAllDetails() + { + + } + } + /// Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType + /// is given as TransferAll + public partial interface ITransferConfigurationTransferAllDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Type of the account of data + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the account of data", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string IncludeDataAccountType { get; set; } + /// To indicate if all Azure blobs have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"To indicate if all Azure blobs have to be transferred", + SerializedName = @"transferAllBlobs", + PossibleTypes = new [] { typeof(bool) })] + bool? IncludeTransferAllBlob { get; set; } + /// To indicate if all Azure Files have to be transferred + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"To indicate if all Azure Files have to be transferred", + SerializedName = @"transferAllFiles", + PossibleTypes = new [] { typeof(bool) })] + bool? IncludeTransferAllFile { get; set; } + + } + /// Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType + /// is given as TransferAll + internal partial interface ITransferConfigurationTransferAllDetailsInternal + + { + /// Details to transfer all data. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferAllDetails Include { get; set; } + /// Type of the account of data + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string IncludeDataAccountType { get; set; } + /// To indicate if all Azure blobs have to be transferred + bool? IncludeTransferAllBlob { get; set; } + /// To indicate if all Azure Files have to be transferred + bool? IncludeTransferAllFile { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.json.cs new file mode 100644 index 00000000000..f1e95aa9da2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferAllDetails.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType + /// is given as TransferAll + /// + public partial class TransferConfigurationTransferAllDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferAllDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new TransferConfigurationTransferAllDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._include ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._include.ToJson(null,serializationMode) : null, "include" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal TransferConfigurationTransferAllDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_include = If( json?.PropertyT("include"), out var __jsonInclude) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferAllDetails.FromJson(__jsonInclude) : _include;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.PowerShell.cs new file mode 100644 index 00000000000..0995460079f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.PowerShell.cs @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as + /// TransferUsingFilter. + /// + [System.ComponentModel.TypeConverter(typeof(TransferConfigurationTransferFilterDetailsTypeConverter))] + public partial class TransferConfigurationTransferFilterDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransferConfigurationTransferFilterDetails(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.DataBox.Models.ITransferConfigurationTransferFilterDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransferConfigurationTransferFilterDetails(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.DataBox.Models.ITransferConfigurationTransferFilterDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransferConfigurationTransferFilterDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Include")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).Include = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails) content.GetValueForProperty("Include",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).Include, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeBlobFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeBlobFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails) content.GetValueForProperty("IncludeBlobFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeBlobFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.BlobFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeAzureFileFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeAzureFileFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails) content.GetValueForProperty("IncludeAzureFileFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeAzureFileFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AzureFileFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeDataAccountType = (string) content.GetValueForProperty("IncludeDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("IncludeFilterFileDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeFilterFileDetail = (System.Collections.Generic.List) content.GetValueForProperty("IncludeFilterFileDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeFilterFileDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.FilterFileDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("BlobFilterDetailBlobPrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).BlobFilterDetailBlobPrefixList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).BlobFilterDetailBlobPrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailBlobPathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).BlobFilterDetailBlobPathList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).BlobFilterDetailBlobPathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailContainerList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).BlobFilterDetailContainerList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailContainerList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).BlobFilterDetailContainerList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).AzureFileFilterDetailFilePrefixList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).AzureFileFilterDetailFilePrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).AzureFileFilterDetailFilePathList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).AzureFileFilterDetailFilePathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFileShareList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).AzureFileFilterDetailFileShareList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFileShareList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).AzureFileFilterDetailFileShareList, __y => TypeConverterExtensions.SelectToList(__y, 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 TransferConfigurationTransferFilterDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Include")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).Include = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails) content.GetValueForProperty("Include",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).Include, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeBlobFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeBlobFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails) content.GetValueForProperty("IncludeBlobFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeBlobFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.BlobFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeAzureFileFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeAzureFileFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails) content.GetValueForProperty("IncludeAzureFileFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeAzureFileFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AzureFileFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("IncludeDataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeDataAccountType = (string) content.GetValueForProperty("IncludeDataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeDataAccountType, global::System.Convert.ToString); + } + if (content.Contains("IncludeFilterFileDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeFilterFileDetail = (System.Collections.Generic.List) content.GetValueForProperty("IncludeFilterFileDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).IncludeFilterFileDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.FilterFileDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("BlobFilterDetailBlobPrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).BlobFilterDetailBlobPrefixList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).BlobFilterDetailBlobPrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailBlobPathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).BlobFilterDetailBlobPathList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).BlobFilterDetailBlobPathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailContainerList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).BlobFilterDetailContainerList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailContainerList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).BlobFilterDetailContainerList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).AzureFileFilterDetailFilePrefixList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).AzureFileFilterDetailFilePrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).AzureFileFilterDetailFilePathList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).AzureFileFilterDetailFilePathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFileShareList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).AzureFileFilterDetailFileShareList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFileShareList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal)this).AzureFileFilterDetailFileShareList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + } + /// Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as + /// TransferUsingFilter. + [System.ComponentModel.TypeConverter(typeof(TransferConfigurationTransferFilterDetailsTypeConverter))] + public partial interface ITransferConfigurationTransferFilterDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.TypeConverter.cs new file mode 100644 index 00000000000..6b6221ef14f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransferConfigurationTransferFilterDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransferConfigurationTransferFilterDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransferConfigurationTransferFilterDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransferConfigurationTransferFilterDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.cs new file mode 100644 index 00000000000..956d323abec --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as + /// TransferUsingFilter. + /// + public partial class TransferConfigurationTransferFilterDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal + { + + /// List of full path of the files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AzureFileFilterDetailFilePathList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).AzureFileFilterDetailFilePathList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).AzureFileFilterDetailFilePathList = value ?? null /* arrayOf */; } + + /// Prefix list of the Azure files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AzureFileFilterDetailFilePrefixList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).AzureFileFilterDetailFilePrefixList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).AzureFileFilterDetailFilePrefixList = value ?? null /* arrayOf */; } + + /// List of file shares to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AzureFileFilterDetailFileShareList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).AzureFileFilterDetailFileShareList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).AzureFileFilterDetailFileShareList = value ?? null /* arrayOf */; } + + /// List of full path of the blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List BlobFilterDetailBlobPathList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).BlobFilterDetailBlobPathList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).BlobFilterDetailBlobPathList = value ?? null /* arrayOf */; } + + /// Prefix list of the Azure blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List BlobFilterDetailBlobPrefixList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).BlobFilterDetailBlobPrefixList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).BlobFilterDetailBlobPrefixList = value ?? null /* arrayOf */; } + + /// List of blob containers to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List BlobFilterDetailContainerList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).BlobFilterDetailContainerList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).BlobFilterDetailContainerList = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails _include; + + /// Details of the filtering the transfer of data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails Include { get => (this._include = this._include ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferFilterDetails()); set => this._include = value; } + + /// Type of the account of data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string IncludeDataAccountType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).DataAccountType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).DataAccountType = value ?? null; } + + /// Details of the filter files to be used for data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List IncludeFilterFileDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).FilterFileDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).FilterFileDetail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Include + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal.Include { get => (this._include = this._include ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferFilterDetails()); set { {_include = value;} } } + + /// Internal Acessors for IncludeAzureFileFilterDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal.IncludeAzureFileFilterDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).AzureFileFilterDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).AzureFileFilterDetail = value ?? null /* model class */; } + + /// Internal Acessors for IncludeBlobFilterDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetailsInternal.IncludeBlobFilterDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).BlobFilterDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)Include).BlobFilterDetail = value ?? null /* model class */; } + + /// + /// Creates an new instance. + /// + public TransferConfigurationTransferFilterDetails() + { + + } + } + /// Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as + /// TransferUsingFilter. + public partial interface ITransferConfigurationTransferFilterDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// List of full path of the files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of full path of the files to be transferred.", + SerializedName = @"filePathList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AzureFileFilterDetailFilePathList { get; set; } + /// Prefix list of the Azure files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Prefix list of the Azure files to be transferred.", + SerializedName = @"filePrefixList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AzureFileFilterDetailFilePrefixList { get; set; } + /// List of file shares to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of file shares to be transferred.", + SerializedName = @"fileShareList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AzureFileFilterDetailFileShareList { get; set; } + /// List of full path of the blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of full path of the blobs to be transferred.", + SerializedName = @"blobPathList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobFilterDetailBlobPathList { get; set; } + /// Prefix list of the Azure blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Prefix list of the Azure blobs to be transferred.", + SerializedName = @"blobPrefixList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobFilterDetailBlobPrefixList { get; set; } + /// List of blob containers to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of blob containers to be transferred.", + SerializedName = @"containerList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobFilterDetailContainerList { get; set; } + /// Type of the account of data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the account of data.", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string IncludeDataAccountType { get; set; } + /// Details of the filter files to be used for data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details of the filter files to be used for data transfer.", + SerializedName = @"filterFileDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetails) })] + System.Collections.Generic.List IncludeFilterFileDetail { get; set; } + + } + /// Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as + /// TransferUsingFilter. + internal partial interface ITransferConfigurationTransferFilterDetailsInternal + + { + /// List of full path of the files to be transferred. + System.Collections.Generic.List AzureFileFilterDetailFilePathList { get; set; } + /// Prefix list of the Azure files to be transferred. + System.Collections.Generic.List AzureFileFilterDetailFilePrefixList { get; set; } + /// List of file shares to be transferred. + System.Collections.Generic.List AzureFileFilterDetailFileShareList { get; set; } + /// List of full path of the blobs to be transferred. + System.Collections.Generic.List BlobFilterDetailBlobPathList { get; set; } + /// Prefix list of the Azure blobs to be transferred. + System.Collections.Generic.List BlobFilterDetailBlobPrefixList { get; set; } + /// List of blob containers to be transferred. + System.Collections.Generic.List BlobFilterDetailContainerList { get; set; } + /// Details of the filtering the transfer of data. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails Include { get; set; } + /// Filter details to transfer Azure files. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails IncludeAzureFileFilterDetail { get; set; } + /// Filter details to transfer blobs. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails IncludeBlobFilterDetail { get; set; } + /// Type of the account of data. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string IncludeDataAccountType { get; set; } + /// Details of the filter files to be used for data transfer. + System.Collections.Generic.List IncludeFilterFileDetail { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.json.cs new file mode 100644 index 00000000000..ca70e13d404 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferConfigurationTransferFilterDetails.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as + /// TransferUsingFilter. + /// + public partial class TransferConfigurationTransferFilterDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferConfigurationTransferFilterDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new TransferConfigurationTransferFilterDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._include ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._include.ToJson(null,serializationMode) : null, "include" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal TransferConfigurationTransferFilterDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_include = If( json?.PropertyT("include"), out var __jsonInclude) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransferFilterDetails.FromJson(__jsonInclude) : _include;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.PowerShell.cs new file mode 100644 index 00000000000..38df277cfe0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.PowerShell.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Details of the filtering the transfer of data. + [System.ComponentModel.TypeConverter(typeof(TransferFilterDetailsTypeConverter))] + public partial class TransferFilterDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransferFilterDetails(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.DataBox.Models.ITransferFilterDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransferFilterDetails(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.DataBox.Models.ITransferFilterDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransferFilterDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BlobFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails) content.GetValueForProperty("BlobFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.BlobFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("AzureFileFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails) content.GetValueForProperty("AzureFileFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AzureFileFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("FilterFileDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).FilterFileDetail = (System.Collections.Generic.List) content.GetValueForProperty("FilterFileDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).FilterFileDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.FilterFileDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("BlobFilterDetailBlobPrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetailBlobPrefixList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetailBlobPrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailBlobPathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetailBlobPathList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetailBlobPathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailContainerList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetailContainerList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailContainerList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetailContainerList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetailFilePrefixList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetailFilePrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetailFilePathList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetailFilePathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFileShareList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetailFileShareList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFileShareList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetailFileShareList, __y => TypeConverterExtensions.SelectToList(__y, 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 TransferFilterDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BlobFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails) content.GetValueForProperty("BlobFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.BlobFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("AzureFileFilterDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails) content.GetValueForProperty("AzureFileFilterDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AzureFileFilterDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DataAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).DataAccountType = (string) content.GetValueForProperty("DataAccountType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).DataAccountType, global::System.Convert.ToString); + } + if (content.Contains("FilterFileDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).FilterFileDetail = (System.Collections.Generic.List) content.GetValueForProperty("FilterFileDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).FilterFileDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.FilterFileDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("BlobFilterDetailBlobPrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetailBlobPrefixList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetailBlobPrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailBlobPathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetailBlobPathList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailBlobPathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetailBlobPathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("BlobFilterDetailContainerList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetailContainerList = (System.Collections.Generic.List) content.GetValueForProperty("BlobFilterDetailContainerList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).BlobFilterDetailContainerList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePrefixList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetailFilePrefixList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePrefixList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetailFilePrefixList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFilePathList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetailFilePathList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFilePathList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetailFilePathList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("AzureFileFilterDetailFileShareList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetailFileShareList = (System.Collections.Generic.List) content.GetValueForProperty("AzureFileFilterDetailFileShareList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal)this).AzureFileFilterDetailFileShareList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + } + /// Details of the filtering the transfer of data. + [System.ComponentModel.TypeConverter(typeof(TransferFilterDetailsTypeConverter))] + public partial interface ITransferFilterDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.TypeConverter.cs new file mode 100644 index 00000000000..67509518031 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransferFilterDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransferFilterDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransferFilterDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransferFilterDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.cs new file mode 100644 index 00000000000..76722ee90c8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details of the filtering the transfer of data. + public partial class TransferFilterDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails _azureFileFilterDetail; + + /// Filter details to transfer Azure files. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails AzureFileFilterDetail { get => (this._azureFileFilterDetail = this._azureFileFilterDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AzureFileFilterDetails()); set => this._azureFileFilterDetail = value; } + + /// List of full path of the files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AzureFileFilterDetailFilePathList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)AzureFileFilterDetail).FilePathList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)AzureFileFilterDetail).FilePathList = value ?? null /* arrayOf */; } + + /// Prefix list of the Azure files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AzureFileFilterDetailFilePrefixList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)AzureFileFilterDetail).FilePrefixList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)AzureFileFilterDetail).FilePrefixList = value ?? null /* arrayOf */; } + + /// List of file shares to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AzureFileFilterDetailFileShareList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)AzureFileFilterDetail).FileShareList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetailsInternal)AzureFileFilterDetail).FileShareList = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails _blobFilterDetail; + + /// Filter details to transfer blobs. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails BlobFilterDetail { get => (this._blobFilterDetail = this._blobFilterDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.BlobFilterDetails()); set => this._blobFilterDetail = value; } + + /// List of full path of the blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List BlobFilterDetailBlobPathList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)BlobFilterDetail).BlobPathList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)BlobFilterDetail).BlobPathList = value ?? null /* arrayOf */; } + + /// Prefix list of the Azure blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List BlobFilterDetailBlobPrefixList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)BlobFilterDetail).BlobPrefixList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)BlobFilterDetail).BlobPrefixList = value ?? null /* arrayOf */; } + + /// List of blob containers to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List BlobFilterDetailContainerList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)BlobFilterDetail).ContainerList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetailsInternal)BlobFilterDetail).ContainerList = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string _dataAccountType; + + /// Type of the account of data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DataAccountType { get => this._dataAccountType; set => this._dataAccountType = value; } + + /// Backing field for property. + private System.Collections.Generic.List _filterFileDetail; + + /// Details of the filter files to be used for data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List FilterFileDetail { get => this._filterFileDetail; set => this._filterFileDetail = value; } + + /// Internal Acessors for AzureFileFilterDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal.AzureFileFilterDetail { get => (this._azureFileFilterDetail = this._azureFileFilterDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AzureFileFilterDetails()); set { {_azureFileFilterDetail = value;} } } + + /// Internal Acessors for BlobFilterDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetailsInternal.BlobFilterDetail { get => (this._blobFilterDetail = this._blobFilterDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.BlobFilterDetails()); set { {_blobFilterDetail = value;} } } + + /// Creates an new instance. + public TransferFilterDetails() + { + + } + } + /// Details of the filtering the transfer of data. + public partial interface ITransferFilterDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// List of full path of the files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of full path of the files to be transferred.", + SerializedName = @"filePathList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AzureFileFilterDetailFilePathList { get; set; } + /// Prefix list of the Azure files to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Prefix list of the Azure files to be transferred.", + SerializedName = @"filePrefixList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AzureFileFilterDetailFilePrefixList { get; set; } + /// List of file shares to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of file shares to be transferred.", + SerializedName = @"fileShareList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List AzureFileFilterDetailFileShareList { get; set; } + /// List of full path of the blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of full path of the blobs to be transferred.", + SerializedName = @"blobPathList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobFilterDetailBlobPathList { get; set; } + /// Prefix list of the Azure blobs to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Prefix list of the Azure blobs to be transferred.", + SerializedName = @"blobPrefixList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobFilterDetailBlobPrefixList { get; set; } + /// List of blob containers to be transferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of blob containers to be transferred.", + SerializedName = @"containerList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List BlobFilterDetailContainerList { get; set; } + /// Type of the account of data. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the account of data.", + SerializedName = @"dataAccountType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string DataAccountType { get; set; } + /// Details of the filter files to be used for data transfer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details of the filter files to be used for data transfer.", + SerializedName = @"filterFileDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IFilterFileDetails) })] + System.Collections.Generic.List FilterFileDetail { get; set; } + + } + /// Details of the filtering the transfer of data. + internal partial interface ITransferFilterDetailsInternal + + { + /// Filter details to transfer Azure files. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAzureFileFilterDetails AzureFileFilterDetail { get; set; } + /// List of full path of the files to be transferred. + System.Collections.Generic.List AzureFileFilterDetailFilePathList { get; set; } + /// Prefix list of the Azure files to be transferred. + System.Collections.Generic.List AzureFileFilterDetailFilePrefixList { get; set; } + /// List of file shares to be transferred. + System.Collections.Generic.List AzureFileFilterDetailFileShareList { get; set; } + /// Filter details to transfer blobs. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IBlobFilterDetails BlobFilterDetail { get; set; } + /// List of full path of the blobs to be transferred. + System.Collections.Generic.List BlobFilterDetailBlobPathList { get; set; } + /// Prefix list of the Azure blobs to be transferred. + System.Collections.Generic.List BlobFilterDetailBlobPrefixList { get; set; } + /// List of blob containers to be transferred. + System.Collections.Generic.List BlobFilterDetailContainerList { get; set; } + /// Type of the account of data. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("StorageAccount", "ManagedDisk")] + string DataAccountType { get; set; } + /// Details of the filter files to be used for data transfer. + System.Collections.Generic.List FilterFileDetail { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.json.cs new file mode 100644 index 00000000000..c141ce6e4b2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransferFilterDetails.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Details of the filtering the transfer of data. + public partial class TransferFilterDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransferFilterDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new TransferFilterDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._blobFilterDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._blobFilterDetail.ToJson(null,serializationMode) : null, "blobFilterDetails" ,container.Add ); + AddIf( null != this._azureFileFilterDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._azureFileFilterDetail.ToJson(null,serializationMode) : null, "azureFileFilterDetails" ,container.Add ); + AddIf( null != (((object)this._dataAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._dataAccountType.ToString()) : null, "dataAccountType" ,container.Add ); + if (null != this._filterFileDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._filterFileDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("filterFileDetails",__w); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal TransferFilterDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_blobFilterDetail = If( json?.PropertyT("blobFilterDetails"), out var __jsonBlobFilterDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.BlobFilterDetails.FromJson(__jsonBlobFilterDetails) : _blobFilterDetail;} + {_azureFileFilterDetail = If( json?.PropertyT("azureFileFilterDetails"), out var __jsonAzureFileFilterDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AzureFileFilterDetails.FromJson(__jsonAzureFileFilterDetails) : _azureFileFilterDetail;} + {_dataAccountType = If( json?.PropertyT("dataAccountType"), out var __jsonDataAccountType) ? (string)__jsonDataAccountType : (string)_dataAccountType;} + {_filterFileDetail = If( json?.PropertyT("filterFileDetails"), out var __jsonFilterFileDetails) ? If( __jsonFilterFileDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IFilterFileDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.FilterFileDetails.FromJson(__u) )) ))() : null : _filterFileDetail;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.PowerShell.cs new file mode 100644 index 00000000000..100bbe1ae79 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Transport options availability details for given region. + [System.ComponentModel.TypeConverter(typeof(TransportAvailabilityDetailsTypeConverter))] + public partial class TransportAvailabilityDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransportAvailabilityDetails(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.DataBox.Models.ITransportAvailabilityDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransportAvailabilityDetails(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.DataBox.Models.ITransportAvailabilityDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransportAvailabilityDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetailsInternal)this).ShipmentType = (string) content.GetValueForProperty("ShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetailsInternal)this).ShipmentType, 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 TransportAvailabilityDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetailsInternal)this).ShipmentType = (string) content.GetValueForProperty("ShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetailsInternal)this).ShipmentType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Transport options availability details for given region. + [System.ComponentModel.TypeConverter(typeof(TransportAvailabilityDetailsTypeConverter))] + public partial interface ITransportAvailabilityDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.TypeConverter.cs new file mode 100644 index 00000000000..3f76d31d0de --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransportAvailabilityDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransportAvailabilityDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransportAvailabilityDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransportAvailabilityDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.cs new file mode 100644 index 00000000000..1cf0039a54f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Transport options availability details for given region. + public partial class TransportAvailabilityDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetailsInternal + { + + /// Internal Acessors for ShipmentType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetailsInternal.ShipmentType { get => this._shipmentType; set { {_shipmentType = value;} } } + + /// Backing field for property. + private string _shipmentType; + + /// Transport Shipment Type supported for given region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ShipmentType { get => this._shipmentType; } + + /// Creates an new instance. + public TransportAvailabilityDetails() + { + + } + } + /// Transport options availability details for given region. + public partial interface ITransportAvailabilityDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Transport Shipment Type supported for given region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Transport Shipment Type supported for given region.", + SerializedName = @"shipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string ShipmentType { get; } + + } + /// Transport options availability details for given region. + internal partial interface ITransportAvailabilityDetailsInternal + + { + /// Transport Shipment Type supported for given region. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string ShipmentType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.json.cs new file mode 100644 index 00000000000..eedb9d0426c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityDetails.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Transport options availability details for given region. + public partial class TransportAvailabilityDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new TransportAvailabilityDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._shipmentType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._shipmentType.ToString()) : null, "shipmentType" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal TransportAvailabilityDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_shipmentType = If( json?.PropertyT("shipmentType"), out var __jsonShipmentType) ? (string)__jsonShipmentType : (string)_shipmentType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.PowerShell.cs new file mode 100644 index 00000000000..f7ef2de1fa3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Request body to get the transport availability for given sku. + [System.ComponentModel.TypeConverter(typeof(TransportAvailabilityRequestTypeConverter))] + public partial class TransportAvailabilityRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransportAvailabilityRequest(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.DataBox.Models.ITransportAvailabilityRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransportAvailabilityRequest(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.DataBox.Models.ITransportAvailabilityRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransportAvailabilityRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal)this).Model, 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 TransportAvailabilityRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal)this).Model, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Request body to get the transport availability for given sku. + [System.ComponentModel.TypeConverter(typeof(TransportAvailabilityRequestTypeConverter))] + public partial interface ITransportAvailabilityRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.TypeConverter.cs new file mode 100644 index 00000000000..b90fbcdcba3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransportAvailabilityRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransportAvailabilityRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransportAvailabilityRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransportAvailabilityRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.cs new file mode 100644 index 00000000000..1980721a7a1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the transport availability for given sku. + public partial class TransportAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequestInternal + { + + /// Backing field for property. + private string _model; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Model { get => this._model; set => this._model = value; } + + /// Backing field for property. + private string _skuName; + + /// Type of the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string SkuName { get => this._skuName; set => this._skuName = value; } + + /// Creates an new instance. + public TransportAvailabilityRequest() + { + + } + } + /// Request body to get the transport availability for given sku. + public partial interface ITransportAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Type of the device. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of the device.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string SkuName { get; set; } + + } + /// Request body to get the transport availability for given sku. + internal partial interface ITransportAvailabilityRequestInternal + + { + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Type of the device. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string SkuName { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.json.cs new file mode 100644 index 00000000000..e78e6577032 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Request body to get the transport availability for given sku. + public partial class TransportAvailabilityRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new TransportAvailabilityRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._skuName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._skuName.ToString()) : null, "skuName" ,container.Add ); + AddIf( null != (((object)this._model)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._model.ToString()) : null, "model" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal TransportAvailabilityRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_skuName = If( json?.PropertyT("skuName"), out var __jsonSkuName) ? (string)__jsonSkuName : (string)_skuName;} + {_model = If( json?.PropertyT("model"), out var __jsonModel) ? (string)__jsonModel : (string)_model;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.PowerShell.cs new file mode 100644 index 00000000000..8926160753c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Transport options available for given sku in a region. + [System.ComponentModel.TypeConverter(typeof(TransportAvailabilityResponseTypeConverter))] + public partial class TransportAvailabilityResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransportAvailabilityResponse(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.DataBox.Models.ITransportAvailabilityResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransportAvailabilityResponse(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.DataBox.Models.ITransportAvailabilityResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransportAvailabilityResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TransportAvailabilityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponseInternal)this).TransportAvailabilityDetail = (System.Collections.Generic.List) content.GetValueForProperty("TransportAvailabilityDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponseInternal)this).TransportAvailabilityDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransportAvailabilityResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TransportAvailabilityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponseInternal)this).TransportAvailabilityDetail = (System.Collections.Generic.List) content.GetValueForProperty("TransportAvailabilityDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponseInternal)this).TransportAvailabilityDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// Transport options available for given sku in a region. + [System.ComponentModel.TypeConverter(typeof(TransportAvailabilityResponseTypeConverter))] + public partial interface ITransportAvailabilityResponse + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.TypeConverter.cs new file mode 100644 index 00000000000..3a9e96f7f22 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransportAvailabilityResponseTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransportAvailabilityResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransportAvailabilityResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransportAvailabilityResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.cs new file mode 100644 index 00000000000..fca887b787b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Transport options available for given sku in a region. + public partial class TransportAvailabilityResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponseInternal + { + + /// Internal Acessors for TransportAvailabilityDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponseInternal.TransportAvailabilityDetail { get => this._transportAvailabilityDetail; set { {_transportAvailabilityDetail = value;} } } + + /// Backing field for property. + private System.Collections.Generic.List _transportAvailabilityDetail; + + /// List of transport availability details for given region + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List TransportAvailabilityDetail { get => this._transportAvailabilityDetail; } + + /// Creates an new instance. + public TransportAvailabilityResponse() + { + + } + } + /// Transport options available for given sku in a region. + public partial interface ITransportAvailabilityResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// List of transport availability details for given region + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of transport availability details for given region", + SerializedName = @"transportAvailabilityDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityDetails) })] + System.Collections.Generic.List TransportAvailabilityDetail { get; } + + } + /// Transport options available for given sku in a region. + internal partial interface ITransportAvailabilityResponseInternal + + { + /// List of transport availability details for given region + System.Collections.Generic.List TransportAvailabilityDetail { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.json.cs new file mode 100644 index 00000000000..23232a50b32 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportAvailabilityResponse.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Transport options available for given sku in a region. + public partial class TransportAvailabilityResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportAvailabilityResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new TransportAvailabilityResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._transportAvailabilityDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._transportAvailabilityDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("transportAvailabilityDetails",__w); + } + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal TransportAvailabilityResponse(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_transportAvailabilityDetail = If( json?.PropertyT("transportAvailabilityDetails"), out var __jsonTransportAvailabilityDetails) ? If( __jsonTransportAvailabilityDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.ITransportAvailabilityDetails) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportAvailabilityDetails.FromJson(__u) )) ))() : null : _transportAvailabilityDetail;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.PowerShell.cs new file mode 100644 index 00000000000..385d6426cb6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Preferences related to the shipment logistics of the sku + [System.ComponentModel.TypeConverter(typeof(TransportPreferencesTypeConverter))] + public partial class TransportPreferences + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransportPreferences(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.DataBox.Models.ITransportPreferences DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransportPreferences(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.DataBox.Models.ITransportPreferences FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransportPreferences(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)this).PreferredShipmentType = (string) content.GetValueForProperty("PreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)this).PreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("IsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)this).IsUpdated = (bool?) content.GetValueForProperty("IsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)this).IsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransportPreferences(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)this).PreferredShipmentType = (string) content.GetValueForProperty("PreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)this).PreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("IsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)this).IsUpdated = (bool?) content.GetValueForProperty("IsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)this).IsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + } + /// Preferences related to the shipment logistics of the sku + [System.ComponentModel.TypeConverter(typeof(TransportPreferencesTypeConverter))] + public partial interface ITransportPreferences + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.TypeConverter.cs new file mode 100644 index 00000000000..ad925e72484 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransportPreferencesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransportPreferences.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransportPreferences.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransportPreferences.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.cs new file mode 100644 index 00000000000..37fe278d5f4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Preferences related to the shipment logistics of the sku + public partial class TransportPreferences : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal + { + + /// Backing field for property. + private bool? _isUpdated; + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public bool? IsUpdated { get => this._isUpdated; } + + /// Internal Acessors for IsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal.IsUpdated { get => this._isUpdated; set { {_isUpdated = value;} } } + + /// Backing field for property. + private string _preferredShipmentType; + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string PreferredShipmentType { get => this._preferredShipmentType; set => this._preferredShipmentType = value; } + + /// Creates an new instance. + public TransportPreferences() + { + + } + } + /// Preferences related to the shipment logistics of the sku + public partial interface ITransportPreferences : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? IsUpdated { get; } + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates Shipment Logistics type that the customer preferred.", + SerializedName = @"preferredShipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string PreferredShipmentType { get; set; } + + } + /// Preferences related to the shipment logistics of the sku + internal partial interface ITransportPreferencesInternal + + { + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + bool? IsUpdated { get; set; } + /// Indicates Shipment Logistics type that the customer preferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string PreferredShipmentType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.json.cs new file mode 100644 index 00000000000..3c654f5ac3d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/TransportPreferences.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Preferences related to the shipment logistics of the sku + public partial class TransportPreferences + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new TransportPreferences(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._preferredShipmentType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._preferredShipmentType.ToString()) : null, "preferredShipmentType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._isUpdated ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonBoolean((bool)this._isUpdated) : null, "isUpdated" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal TransportPreferences(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_preferredShipmentType = If( json?.PropertyT("preferredShipmentType"), out var __jsonPreferredShipmentType) ? (string)__jsonPreferredShipmentType : (string)_preferredShipmentType;} + {_isUpdated = If( json?.PropertyT("isUpdated"), out var __jsonIsUpdated) ? (bool?)__jsonIsUpdated : _isUpdated;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.PowerShell.cs new file mode 100644 index 00000000000..e24e1bdff80 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.PowerShell.cs @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Unencrypted credentials for accessing device. + [System.ComponentModel.TypeConverter(typeof(UnencryptedCredentialsTypeConverter))] + public partial class UnencryptedCredentials + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentials DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UnencryptedCredentials(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.DataBox.Models.IUnencryptedCredentials DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UnencryptedCredentials(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.DataBox.Models.IUnencryptedCredentials FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UnencryptedCredentials(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("JobSecret")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecret = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets) content.GetValueForProperty("JobSecret",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecret, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecretsTypeConverter.ConvertFrom); + } + if (content.Contains("JobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobName, global::System.Convert.ToString); + } + if (content.Contains("JobSecretDcAccessSecurityCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecretDcAccessSecurityCode = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode) content.GetValueForProperty("JobSecretDcAccessSecurityCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecretDcAccessSecurityCode, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCodeTypeConverter.ConvertFrom); + } + if (content.Contains("JobSecretError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecretError = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("JobSecretError",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecretError, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("JobSecretJobSecretsType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecretJobSecretsType = (string) content.GetValueForProperty("JobSecretJobSecretsType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecretJobSecretsType, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).DcAccessSecurityCodeReverseDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).DcAccessSecurityCodeReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).DcAccessSecurityCodeForwardDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).DcAccessSecurityCodeForwardDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Target, 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 UnencryptedCredentials(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("JobSecret")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecret = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets) content.GetValueForProperty("JobSecret",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecret, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecretsTypeConverter.ConvertFrom); + } + if (content.Contains("JobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobName, global::System.Convert.ToString); + } + if (content.Contains("JobSecretDcAccessSecurityCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecretDcAccessSecurityCode = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode) content.GetValueForProperty("JobSecretDcAccessSecurityCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecretDcAccessSecurityCode, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.DcAccessSecurityCodeTypeConverter.ConvertFrom); + } + if (content.Contains("JobSecretError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecretError = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("JobSecretError",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecretError, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("JobSecretJobSecretsType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecretJobSecretsType = (string) content.GetValueForProperty("JobSecretJobSecretsType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).JobSecretJobSecretsType, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeReverseDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).DcAccessSecurityCodeReverseDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeReverseDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).DcAccessSecurityCodeReverseDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("DcAccessSecurityCodeForwardDcAccessCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).DcAccessSecurityCodeForwardDcAccessCode = (string) content.GetValueForProperty("DcAccessSecurityCodeForwardDcAccessCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).DcAccessSecurityCodeForwardDcAccessCode, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal)this).Target, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Unencrypted credentials for accessing device. + [System.ComponentModel.TypeConverter(typeof(UnencryptedCredentialsTypeConverter))] + public partial interface IUnencryptedCredentials + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.TypeConverter.cs new file mode 100644 index 00000000000..d96638cc4cd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UnencryptedCredentialsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentials ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentials).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UnencryptedCredentials.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UnencryptedCredentials.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UnencryptedCredentials.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.cs new file mode 100644 index 00000000000..254dcdac175 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.cs @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Unencrypted credentials for accessing device. + public partial class UnencryptedCredentials : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentials, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal + { + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).AdditionalInfo; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Code; } + + /// Forward Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DcAccessSecurityCodeForwardDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).DcAccessSecurityCodeForwardDcAccessCode; } + + /// Reverse Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string DcAccessSecurityCodeReverseDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).DcAccessSecurityCodeReverseDcAccessCode; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Detail; } + + /// Backing field for property. + private string _jobName; + + /// Name of the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string JobName { get => this._jobName; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets _jobSecret; + + /// Secrets related to this job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets JobSecret { get => (this._jobSecret = this._jobSecret ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecrets()); } + + /// Used to indicate what type of job secrets object. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string JobSecretJobSecretsType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Type; } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Code = value ?? null; } + + /// Internal Acessors for DcAccessSecurityCodeForwardDcAccessCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal.DcAccessSecurityCodeForwardDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).DcAccessSecurityCodeForwardDcAccessCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).DcAccessSecurityCodeForwardDcAccessCode = value ?? null; } + + /// Internal Acessors for DcAccessSecurityCodeReverseDcAccessCode + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal.DcAccessSecurityCodeReverseDcAccessCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).DcAccessSecurityCodeReverseDcAccessCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).DcAccessSecurityCodeReverseDcAccessCode = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for JobName + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal.JobName { get => this._jobName; set { {_jobName = value;} } } + + /// Internal Acessors for JobSecret + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal.JobSecret { get => (this._jobSecret = this._jobSecret ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecrets()); set { {_jobSecret = value;} } } + + /// Internal Acessors for JobSecretDcAccessSecurityCode + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal.JobSecretDcAccessSecurityCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).DcAccessSecurityCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).DcAccessSecurityCode = value ?? null /* model class */; } + + /// Internal Acessors for JobSecretError + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal.JobSecretError { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Error = value ?? null /* model class */; } + + /// Internal Acessors for JobSecretJobSecretsType + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal.JobSecretJobSecretsType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Type = value ?? null; } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Target = value ?? null; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecretsInternal)JobSecret).Target; } + + /// Creates an new instance. + public UnencryptedCredentials() + { + + } + } + /// Unencrypted credentials for accessing device. + public partial interface IUnencryptedCredentials : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets additional error info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// Forward Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Forward Dc access security code.", + SerializedName = @"forwardDCAccessCode", + PossibleTypes = new [] { typeof(string) })] + string DcAccessSecurityCodeForwardDcAccessCode { get; } + /// Reverse Dc access security code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Reverse Dc access security code.", + SerializedName = @"reverseDCAccessCode", + PossibleTypes = new [] { typeof(string) })] + string DcAccessSecurityCodeReverseDcAccessCode { get; } + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets details for the error.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) })] + System.Collections.Generic.List Detail { get; } + /// Name of the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Name of the job.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + string JobName { get; } + /// Used to indicate what type of job secrets object. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Used to indicate what type of job secrets object.", + SerializedName = @"jobSecretsType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string JobSecretJobSecretsType { get; } + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message parsed from the body of the http error response.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the target of the error.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// Unencrypted credentials for accessing device. + internal partial interface IUnencryptedCredentialsInternal + + { + /// Gets or sets additional error info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// Error code. + string Code { get; set; } + /// Forward Dc access security code. + string DcAccessSecurityCodeForwardDcAccessCode { get; set; } + /// Reverse Dc access security code. + string DcAccessSecurityCodeReverseDcAccessCode { get; set; } + /// Gets or sets details for the error. + System.Collections.Generic.List Detail { get; set; } + /// Name of the job. + string JobName { get; set; } + /// Secrets related to this job. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobSecrets JobSecret { get; set; } + /// Dc Access Security Code for Customer Managed Shipping + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDcAccessSecurityCode JobSecretDcAccessSecurityCode { get; set; } + /// Error while fetching the secrets. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError JobSecretError { get; set; } + /// Used to indicate what type of job secrets object. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string JobSecretJobSecretsType { get; set; } + /// The error message parsed from the body of the http error response. + string Message { get; set; } + /// Gets or sets the target of the error. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.json.cs new file mode 100644 index 00000000000..67d7908fbd7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentials.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Unencrypted credentials for accessing device. + public partial class UnencryptedCredentials + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentials. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentials. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentials FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new UnencryptedCredentials(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._jobSecret ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._jobSecret.ToJson(null,serializationMode) : null, "jobSecrets" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._jobName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._jobName.ToString()) : null, "jobName" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal UnencryptedCredentials(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_jobSecret = If( json?.PropertyT("jobSecrets"), out var __jsonJobSecrets) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobSecrets.FromJson(__jsonJobSecrets) : _jobSecret;} + {_jobName = If( json?.PropertyT("jobName"), out var __jsonJobName) ? (string)__jsonJobName : (string)_jobName;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.PowerShell.cs new file mode 100644 index 00000000000..7a247310be7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// List of unencrypted credentials for accessing device. + [System.ComponentModel.TypeConverter(typeof(UnencryptedCredentialsListTypeConverter))] + public partial class UnencryptedCredentialsList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UnencryptedCredentialsList(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.DataBox.Models.IUnencryptedCredentialsList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UnencryptedCredentialsList(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.DataBox.Models.IUnencryptedCredentialsList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UnencryptedCredentialsList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UnencryptedCredentialsTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsListInternal)this).NextLink, 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 UnencryptedCredentialsList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UnencryptedCredentialsTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsListInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// List of unencrypted credentials for accessing device. + [System.ComponentModel.TypeConverter(typeof(UnencryptedCredentialsListTypeConverter))] + public partial interface IUnencryptedCredentialsList + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.TypeConverter.cs new file mode 100644 index 00000000000..c32dadff710 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UnencryptedCredentialsListTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UnencryptedCredentialsList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UnencryptedCredentialsList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UnencryptedCredentialsList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.cs new file mode 100644 index 00000000000..85f237a6b7c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// List of unencrypted credentials for accessing device. + public partial class UnencryptedCredentialsList : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsList, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsListInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to the next page of items + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// The UnencryptedCredentials items on this page + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public UnencryptedCredentialsList() + { + + } + } + /// List of unencrypted credentials for accessing device. + public partial interface IUnencryptedCredentialsList : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// The link to the next page of items + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.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) })] + string NextLink { get; set; } + /// The UnencryptedCredentials items on this page + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The UnencryptedCredentials items on this page", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentials) })] + System.Collections.Generic.List Value { get; set; } + + } + /// List of unencrypted credentials for accessing device. + internal partial interface IUnencryptedCredentialsListInternal + + { + /// The link to the next page of items + string NextLink { get; set; } + /// The UnencryptedCredentials items on this page + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.json.cs new file mode 100644 index 00000000000..62ef79f377a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UnencryptedCredentialsList.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// List of unencrypted credentials for accessing device. + public partial class UnencryptedCredentialsList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentialsList FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new UnencryptedCredentialsList(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal UnencryptedCredentialsList(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IUnencryptedCredentials) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UnencryptedCredentials.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.PowerShell.cs new file mode 100644 index 00000000000..ad899f6be2d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.PowerShell.cs @@ -0,0 +1,666 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Job details for update. + [System.ComponentModel.TypeConverter(typeof(UpdateJobDetailsTypeConverter))] + public partial class UpdateJobDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateJobDetails(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.DataBox.Models.IUpdateJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateJobDetails(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.DataBox.Models.IUpdateJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateJobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails) content.GetValueForProperty("ReverseShippingDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey) content.GetValueForProperty("KeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKeyTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnToCustomerPackageDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails) content.GetValueForProperty("ReturnToCustomerPackageDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ContactDetailEmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailEmailList = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailEmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailEmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContactDetailNotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailNotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailNotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailNotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ReverseShippingDetailShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyIdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("KeyEncryptionKeyIdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyKekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyKekType = (string) content.GetValueForProperty("KeyEncryptionKeyKekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyKekType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsContactName = (string) content.GetValueForProperty("ContactDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsPhone = (string) content.GetValueForProperty("ContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsPhoneExtension = (string) content.GetValueForProperty("ContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsMobile = (string) content.GetValueForProperty("ContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ReverseShippingDetailContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailIsUpdated = (bool?) content.GetValueForProperty("ReverseShippingDetailIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyKekUrl = (string) content.GetValueForProperty("KeyEncryptionKeyKekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyKekUrl, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId = (string) content.GetValueForProperty("KeyEncryptionKeyKekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("ReturnToCustomerPackageDetailCarrierAccountNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierAccountNumber = (System.Security.SecureString) content.GetValueForProperty("ReturnToCustomerPackageDetailCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierAccountNumber, (object ss) => (System.Security.SecureString)ss); + } + if (content.Contains("ReturnToCustomerPackageDetailCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierName = (string) content.GetValueForProperty("ReturnToCustomerPackageDetailCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnToCustomerPackageDetailTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetailTrackingId = (string) content.GetValueForProperty("ReturnToCustomerPackageDetailTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetailTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactName = (string) content.GetValueForProperty("ReverseShippingDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ReverseShippingDetailsShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).UserAssignedResourceId, 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 UpdateJobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails) content.GetValueForProperty("ContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails) content.GetValueForProperty("ReverseShippingDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Preference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).Preference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences) content.GetValueForProperty("Preference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).Preference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKey = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey) content.GetValueForProperty("KeyEncryptionKey",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKey, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKeyTypeConverter.ConvertFrom); + } + if (content.Contains("ReturnToCustomerPackageDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails) content.GetValueForProperty("ReturnToCustomerPackageDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ContactDetailEmailList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailEmailList = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailEmailList",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailEmailList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("ContactDetailNotificationPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailNotificationPreference = (System.Collections.Generic.List) content.GetValueForProperty("ContactDetailNotificationPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailNotificationPreference, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.NotificationPreferenceTypeConverter.ConvertFrom)); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ReverseShippingDetailShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferenceEncryptionPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceEncryptionPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences) content.GetValueForProperty("PreferenceEncryptionPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceEncryptionPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.EncryptionPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyIdentityProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties) content.GetValueForProperty("KeyEncryptionKeyIdentityProperty",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyIdentityProperty, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IdentityPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyKekType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyKekType = (string) content.GetValueForProperty("KeyEncryptionKeyKekType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyKekType, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsContactName = (string) content.GetValueForProperty("ContactDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsPhone = (string) content.GetValueForProperty("ContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsPhoneExtension = (string) content.GetValueForProperty("ContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsMobile = (string) content.GetValueForProperty("ContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("StreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StreetAddress3 = (string) content.GetValueForProperty("StreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("StateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).StateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("PostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PostalCode, global::System.Convert.ToString); + } + if (content.Contains("ZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ZipExtendedCode = (string) content.GetValueForProperty("ZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("CompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).CompanyName = (string) content.GetValueForProperty("CompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).CompanyName, global::System.Convert.ToString); + } + if (content.Contains("SkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).SkipAddressValidation = (bool?) content.GetValueForProperty("SkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).SkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).TaxIdentificationNumber = (string) content.GetValueForProperty("TaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).TaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo) content.GetValueForProperty("ReverseShippingDetailContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailContactDetail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactInfoTypeConverter.ConvertFrom); + } + if (content.Contains("ReverseShippingDetailIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailIsUpdated = (bool?) content.GetValueForProperty("ReverseShippingDetailIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("PreferenceReverseTransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceReverseTransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("PreferenceReverseTransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceReverseTransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("PreferencePreferredDataCenterRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferencePreferredDataCenterRegion = (System.Collections.Generic.List) content.GetValueForProperty("PreferencePreferredDataCenterRegion",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferencePreferredDataCenterRegion, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("PreferenceStorageAccountAccessTierPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference = (System.Collections.Generic.List) content.GetValueForProperty("PreferenceStorageAccountAccessTierPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).PreferenceStorageAccountAccessTierPreference, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("EncryptionPreferenceDoubleEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption = (string) content.GetValueForProperty("EncryptionPreferenceDoubleEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).EncryptionPreferenceDoubleEncryption, global::System.Convert.ToString); + } + if (content.Contains("EncryptionPreferenceHardwareEncryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption = (string) content.GetValueForProperty("EncryptionPreferenceHardwareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).EncryptionPreferenceHardwareEncryption, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyKekUrl = (string) content.GetValueForProperty("KeyEncryptionKeyKekUrl",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyKekUrl, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyKekVaultResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId = (string) content.GetValueForProperty("KeyEncryptionKeyKekVaultResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).KeyEncryptionKeyKekVaultResourceId, global::System.Convert.ToString); + } + if (content.Contains("ReturnToCustomerPackageDetailCarrierAccountNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierAccountNumber = (System.Security.SecureString) content.GetValueForProperty("ReturnToCustomerPackageDetailCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierAccountNumber, (object ss) => (System.Security.SecureString)ss); + } + if (content.Contains("ReturnToCustomerPackageDetailCarrierName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierName = (string) content.GetValueForProperty("ReturnToCustomerPackageDetailCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetailCarrierName, global::System.Convert.ToString); + } + if (content.Contains("ReturnToCustomerPackageDetailTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetailTrackingId = (string) content.GetValueForProperty("ReturnToCustomerPackageDetailTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReturnToCustomerPackageDetailTrackingId, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactName = (string) content.GetValueForProperty("ReverseShippingDetailsContactName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhone",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhone, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsPhoneExtension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsPhoneExtension",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactDetailsPhoneExtension, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsContactDetailsMobile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile = (string) content.GetValueForProperty("ReverseShippingDetailsContactDetailsMobile",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsContactDetailsMobile, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ReverseShippingDetailsShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ReverseShippingDetailsShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseShippingDetailsShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ReverseShippingDetailsShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseShippingDetailsShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ReverseTransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("ReverseTransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseTransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("ReverseTransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("ReverseTransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).ReverseTransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IdentityPropertyUserAssigned")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).IdentityPropertyUserAssigned = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties) content.GetValueForProperty("IdentityPropertyUserAssigned",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).IdentityPropertyUserAssigned, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPropertyType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).IdentityPropertyType = (string) content.GetValueForProperty("IdentityPropertyType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).IdentityPropertyType, global::System.Convert.ToString); + } + if (content.Contains("UserAssignedResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).UserAssignedResourceId = (string) content.GetValueForProperty("UserAssignedResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal)this).UserAssignedResourceId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Job details for update. + [System.ComponentModel.TypeConverter(typeof(UpdateJobDetailsTypeConverter))] + public partial interface IUpdateJobDetails + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.TypeConverter.cs new file mode 100644 index 00000000000..94fdddb1d16 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateJobDetailsTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateJobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateJobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateJobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.cs new file mode 100644 index 00000000000..5b0371a93b7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.cs @@ -0,0 +1,1053 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job details for update. + public partial class UpdateJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal + { + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string City { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).City = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string CompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).CompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).CompanyName = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails _contactDetail; + + /// Contact details for notification and shipping. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails ContactDetail { get => (this._contactDetail = this._contactDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetails()); set => this._contactDetail = value; } + + /// List of Email-ids to be notified about job progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List ContactDetailEmailList { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).EmailList; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).EmailList = value ?? null /* arrayOf */; } + + /// Notification preference for a job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List ContactDetailNotificationPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).NotificationPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).NotificationPreference = value ?? null /* arrayOf */; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ContactDetailsContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).ContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).ContactName = value ?? null; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ContactDetailsMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).Mobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).Mobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ContactDetailsPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).Phone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).Phone = value ?? null; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ContactDetailsPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).PhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetailsInternal)ContactDetail).PhoneExtension = value ?? null; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Country { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).Country = value ?? null; } + + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string EncryptionPreferenceDoubleEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreferenceDoubleEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreferenceDoubleEncryption = value ?? null; } + + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string EncryptionPreferenceHardwareEncryption { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreferenceHardwareEncryption; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreferenceHardwareEncryption = value ?? null; } + + /// Managed service identity type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string IdentityPropertyType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).IdentityPropertyType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).IdentityPropertyType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey _keyEncryptionKey; + + /// Key encryption key for the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey KeyEncryptionKey { get => (this._keyEncryptionKey = this._keyEncryptionKey ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKey()); set => this._keyEncryptionKey = value; } + + /// Type of encryption key used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyKekType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).KekType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).KekType = value ?? null; } + + /// Key encryption key. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyKekUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).KekUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).KekUrl = value ?? null; } + + /// Kek vault resource id. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyKekVaultResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).KekVaultResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).KekVaultResourceId = value ?? null; } + + /// Internal Acessors for ContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.ContactDetail { get => (this._contactDetail = this._contactDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetails()); set { {_contactDetail = value;} } } + + /// Internal Acessors for IdentityPropertyUserAssigned + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.IdentityPropertyUserAssigned { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).IdentityPropertyUserAssigned; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).IdentityPropertyUserAssigned = value ?? null /* model class */; } + + /// Internal Acessors for KeyEncryptionKey + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.KeyEncryptionKey { get => (this._keyEncryptionKey = this._keyEncryptionKey ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKey()); set { {_keyEncryptionKey = value;} } } + + /// Internal Acessors for KeyEncryptionKeyIdentityProperty + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.KeyEncryptionKeyIdentityProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).IdentityProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).IdentityProperty = value ?? null /* model class */; } + + /// Internal Acessors for Preference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.Preference { get => (this._preference = this._preference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Preferences()); set { {_preference = value;} } } + + /// Internal Acessors for PreferenceEncryptionPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.PreferenceEncryptionPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).EncryptionPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceReverseTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.PreferenceReverseTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for PreferenceTransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.PreferenceTransportPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreference = value ?? null /* model class */; } + + /// Internal Acessors for ReturnToCustomerPackageDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.ReturnToCustomerPackageDetail { get => (this._returnToCustomerPackageDetail = this._returnToCustomerPackageDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierDetails()); set { {_returnToCustomerPackageDetail = value;} } } + + /// Internal Acessors for ReverseShippingDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.ReverseShippingDetail { get => (this._reverseShippingDetail = this._reverseShippingDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetails()); set { {_reverseShippingDetail = value;} } } + + /// Internal Acessors for ReverseShippingDetailContactDetail + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.ReverseShippingDetailContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetail = value ?? null /* model class */; } + + /// Internal Acessors for ReverseShippingDetailIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.ReverseShippingDetailIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).IsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).IsUpdated = value ?? default(bool); } + + /// Internal Acessors for ReverseShippingDetailShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.ReverseShippingDetailShippingAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddress = value ?? null /* model class */; } + + /// Internal Acessors for ReverseTransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferenceIsUpdated = value ?? default(bool); } + + /// Internal Acessors for ShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.ShippingAddress { get => (this._shippingAddress = this._shippingAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress()); set { {_shippingAddress = value;} } } + + /// Internal Acessors for TransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetailsInternal.TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferenceIsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferenceIsUpdated = value ?? default(bool); } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string PostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).PostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).PostalCode = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences _preference; + + /// Preferences related to the order + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Preference { get => (this._preference = this._preference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Preferences()); set => this._preference = value; } + + /// Preferred data center region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List PreferencePreferredDataCenterRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).PreferredDataCenterRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).PreferredDataCenterRegion = value ?? null /* arrayOf */; } + + /// Preferences related to the Access Tier of storage accounts. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).StorageAccountAccessTierPreference; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).StorageAccountAccessTierPreference = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails _returnToCustomerPackageDetail; + + /// Return package details of job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails ReturnToCustomerPackageDetail { get => (this._returnToCustomerPackageDetail = this._returnToCustomerPackageDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierDetails()); set => this._returnToCustomerPackageDetail = value; } + + /// Carrier Account Number of customer for customer disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Security.SecureString ReturnToCustomerPackageDetailCarrierAccountNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)ReturnToCustomerPackageDetail).CarrierAccountNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)ReturnToCustomerPackageDetail).CarrierAccountNumber = value ?? null; } + + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReturnToCustomerPackageDetailCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)ReturnToCustomerPackageDetail).CarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)ReturnToCustomerPackageDetail).CarrierName = value ?? null; } + + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReturnToCustomerPackageDetailTrackingId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)ReturnToCustomerPackageDetail).TrackingId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetailsInternal)ReturnToCustomerPackageDetail).TrackingId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails _reverseShippingDetail; + + /// Reverse Shipping Address and contact details for a job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails ReverseShippingDetail { get => (this._reverseShippingDetail = this._reverseShippingDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetails()); set => this._reverseShippingDetail = value; } + + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? ReverseShippingDetailIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).IsUpdated; } + + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsContactDetailsMobile { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailMobile; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailMobile = value ?? null; } + + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsContactDetailsPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailPhone = value ?? null; } + + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsContactDetailsPhoneExtension { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailPhoneExtension; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailPhoneExtension = value ?? null; } + + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsContactName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailContactName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ContactDetailContactName = value ?? null; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressCity = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressCompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressCompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressCompanyName = value ?? null; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressCountry { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressCountry; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressCountry = value ?? null; } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressPostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressPostalCode = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? ReverseShippingDetailsShippingAddressSkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressSkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressSkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressStreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressStreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressTaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressTaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressTaxIdentificationNumber = value ?? null; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressType = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseShippingDetailsShippingAddressZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetailsInternal)ReverseShippingDetail).ShippingAddressZipExtendedCode = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? ReverseTransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ReverseTransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).ReverseTransportPreferencePreferredShipmentType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress _shippingAddress; + + /// Shipping address of the customer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ShippingAddress { get => (this._shippingAddress = this._shippingAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress()); set => this._shippingAddress = value; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).AddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).AddressType = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? SkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).SkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).SkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string StateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string StreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress1 = value ?? null; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string StreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string StreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).TaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).TaxIdentificationNumber = value ?? null; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferenceIsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferencePreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesInternal)Preference).TransportPreferencePreferredShipmentType = value ?? null; } + + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string UserAssignedResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).UserAssignedResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKeyInternal)KeyEncryptionKey).UserAssignedResourceId = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).ZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).ZipExtendedCode = value ?? null; } + + /// Creates an new instance. + public UpdateJobDetails() + { + + } + } + /// Job details for update. + public partial interface IUpdateJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the City.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string City { get; set; } + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the company.", + SerializedName = @"companyName", + PossibleTypes = new [] { typeof(string) })] + string CompanyName { get; set; } + /// List of Email-ids to be notified about job progress. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of Email-ids to be notified about job progress.", + SerializedName = @"emailList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List ContactDetailEmailList { get; set; } + /// Notification preference for a job stage. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Notification preference for a job stage.", + SerializedName = @"notificationPreference", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.INotificationPreference) })] + System.Collections.Generic.List ContactDetailNotificationPreference { get; set; } + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Contact name of the person.", + SerializedName = @"contactName", + PossibleTypes = new [] { typeof(string) })] + string ContactDetailsContactName { get; set; } + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Mobile number of the contact person.", + SerializedName = @"mobile", + PossibleTypes = new [] { typeof(string) })] + string ContactDetailsMobile { get; set; } + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone number of the contact person.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ContactDetailsPhone { get; set; } + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone extension number of the contact person.", + SerializedName = @"phoneExtension", + PossibleTypes = new [] { typeof(string) })] + string ContactDetailsPhoneExtension { get; set; } + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the Country.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string Country { get; set; } + /// Defines secondary layer of software-based encryption enablement. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Defines secondary layer of software-based encryption enablement.", + SerializedName = @"doubleEncryption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceDoubleEncryption { get; set; } + /// Defines Hardware level encryption (Only for disk) + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Defines Hardware level encryption (Only for disk)", + SerializedName = @"hardwareEncryption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceHardwareEncryption { get; set; } + /// Managed service identity type. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Managed service identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string IdentityPropertyType { get; set; } + /// Type of encryption key used for key encryption. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of encryption key used for key encryption.", + SerializedName = @"kekType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("MicrosoftManaged", "CustomerManaged")] + string KeyEncryptionKeyKekType { get; set; } + /// Key encryption key. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Key encryption key. It is required in case of Customer managed KekType.", + SerializedName = @"kekUrl", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyKekUrl { get; set; } + /// Kek vault resource id. It is required in case of Customer managed KekType. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Kek vault resource id. It is required in case of Customer managed KekType.", + SerializedName = @"kekVaultResourceID", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyKekVaultResourceId { get; set; } + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Postal code.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string PostalCode { get; set; } + /// Preferred data center region. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Preferred data center region.", + SerializedName = @"preferredDataCenterRegion", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List PreferencePreferredDataCenterRegion { get; set; } + /// Preferences related to the Access Tier of storage accounts. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Preferences related to the Access Tier of storage accounts.", + SerializedName = @"storageAccountAccessTierPreferences", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Archive")] + System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get; set; } + /// Carrier Account Number of customer for customer disk. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Carrier Account Number of customer for customer disk.", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(System.Security.SecureString) })] + System.Security.SecureString ReturnToCustomerPackageDetailCarrierAccountNumber { get; set; } + /// Name of the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the carrier.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string ReturnToCustomerPackageDetailCarrierName { get; set; } + /// Tracking Id of shipment. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Tracking Id of shipment.", + SerializedName = @"trackingId", + PossibleTypes = new [] { typeof(string) })] + string ReturnToCustomerPackageDetailTrackingId { get; set; } + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + Read only field", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? ReverseShippingDetailIsUpdated { get; } + /// Mobile number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Mobile number of the contact person.", + SerializedName = @"mobile", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsContactDetailsMobile { get; set; } + /// Phone number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone number of the contact person.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsContactDetailsPhone { get; set; } + /// Phone extension number of the contact person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Phone extension number of the contact person.", + SerializedName = @"phoneExtension", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsContactDetailsPhoneExtension { get; set; } + /// Contact name of the person. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Contact name of the person.", + SerializedName = @"contactName", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsContactName { get; set; } + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the City.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressCity { get; set; } + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the company.", + SerializedName = @"companyName", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressCompanyName { get; set; } + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the Country.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressCountry { get; set; } + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Postal code.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressPostalCode { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Flag to indicate if customer has chosen to skip default address validation", + SerializedName = @"skipAddressValidation", + PossibleTypes = new [] { typeof(bool) })] + bool? ReverseShippingDetailsShippingAddressSkipAddressValidation { get; set; } + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the State or Province.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressStateOrProvince { get; set; } + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 1.", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressStreetAddress1 { get; set; } + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 2.", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressStreetAddress2 { get; set; } + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 3.", + SerializedName = @"streetAddress3", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressStreetAddress3 { get; set; } + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Tax Identification Number", + SerializedName = @"taxIdentificationNumber", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressTaxIdentificationNumber { get; set; } + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of address.", + SerializedName = @"addressType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string ReverseShippingDetailsShippingAddressType { get; set; } + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Extended Zip Code.", + SerializedName = @"zipExtendedCode", + PossibleTypes = new [] { typeof(string) })] + string ReverseShippingDetailsShippingAddressZipExtendedCode { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? ReverseTransportPreferenceIsUpdated { get; } + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates Shipment Logistics type that the customer preferred.", + SerializedName = @"preferredShipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string ReverseTransportPreferencePreferredShipmentType { get; set; } + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of address.", + SerializedName = @"addressType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string ShippingAddressType { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Flag to indicate if customer has chosen to skip default address validation", + SerializedName = @"skipAddressValidation", + PossibleTypes = new [] { typeof(bool) })] + bool? SkipAddressValidation { get; set; } + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the State or Province.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string StateOrProvince { get; set; } + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 1.", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress1 { get; set; } + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 2.", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress2 { get; set; } + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 3.", + SerializedName = @"streetAddress3", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress3 { get; set; } + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Tax Identification Number", + SerializedName = @"taxIdentificationNumber", + PossibleTypes = new [] { typeof(string) })] + string TaxIdentificationNumber { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? TransportPreferenceIsUpdated { get; } + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates Shipment Logistics type that the customer preferred.", + SerializedName = @"preferredShipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string TransportPreferencePreferredShipmentType { get; set; } + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Arm resource id for user assigned identity to be used to fetch MSI token.", + SerializedName = @"resourceId", + PossibleTypes = new [] { typeof(string) })] + string UserAssignedResourceId { get; set; } + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Extended Zip Code.", + SerializedName = @"zipExtendedCode", + PossibleTypes = new [] { typeof(string) })] + string ZipExtendedCode { get; set; } + + } + /// Job details for update. + internal partial interface IUpdateJobDetailsInternal + + { + /// Name of the City. + string City { get; set; } + /// Name of the company. + string CompanyName { get; set; } + /// Contact details for notification and shipping. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactDetails ContactDetail { get; set; } + /// List of Email-ids to be notified about job progress. + System.Collections.Generic.List ContactDetailEmailList { get; set; } + /// Notification preference for a job stage. + System.Collections.Generic.List ContactDetailNotificationPreference { get; set; } + /// Contact name of the person. + string ContactDetailsContactName { get; set; } + /// Mobile number of the contact person. + string ContactDetailsMobile { get; set; } + /// Phone number of the contact person. + string ContactDetailsPhone { get; set; } + /// Phone extension number of the contact person. + string ContactDetailsPhoneExtension { get; set; } + /// Name of the Country. + string Country { get; set; } + /// Defines secondary layer of software-based encryption enablement. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceDoubleEncryption { get; set; } + /// Defines Hardware level encryption (Only for disk) + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Enabled", "Disabled")] + string EncryptionPreferenceHardwareEncryption { get; set; } + /// Managed service identity type. + string IdentityPropertyType { get; set; } + /// User assigned identity properties. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties IdentityPropertyUserAssigned { get; set; } + /// Key encryption key for the job. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IKeyEncryptionKey KeyEncryptionKey { get; set; } + /// Managed identity properties used for key encryption. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IIdentityProperties KeyEncryptionKeyIdentityProperty { get; set; } + /// Type of encryption key used for key encryption. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("MicrosoftManaged", "CustomerManaged")] + string KeyEncryptionKeyKekType { get; set; } + /// Key encryption key. It is required in case of Customer managed KekType. + string KeyEncryptionKeyKekUrl { get; set; } + /// Kek vault resource id. It is required in case of Customer managed KekType. + string KeyEncryptionKeyKekVaultResourceId { get; set; } + /// Postal code. + string PostalCode { get; set; } + /// Preferences related to the order + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferences Preference { get; set; } + /// Preferences related to the Encryption. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IEncryptionPreferences PreferenceEncryptionPreference { get; set; } + /// Preferred data center region. + System.Collections.Generic.List PreferencePreferredDataCenterRegion { get; set; } + /// Optional Preferences related to the reverse shipment logistics of the sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceReverseTransportPreference { get; set; } + /// Preferences related to the Access Tier of storage accounts. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("Archive")] + System.Collections.Generic.List PreferenceStorageAccountAccessTierPreference { get; set; } + /// Preferences related to the shipment logistics of the sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences PreferenceTransportPreference { get; set; } + /// Return package details of job. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPackageCarrierDetails ReturnToCustomerPackageDetail { get; set; } + /// Carrier Account Number of customer for customer disk. + System.Security.SecureString ReturnToCustomerPackageDetailCarrierAccountNumber { get; set; } + /// Name of the carrier. + string ReturnToCustomerPackageDetailCarrierName { get; set; } + /// Tracking Id of shipment. + string ReturnToCustomerPackageDetailTrackingId { get; set; } + /// Reverse Shipping Address and contact details for a job. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IReverseShippingDetails ReverseShippingDetail { get; set; } + /// Contact Info. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IContactInfo ReverseShippingDetailContactDetail { get; set; } + /// + /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. + /// Read only field + /// + bool? ReverseShippingDetailIsUpdated { get; set; } + /// Shipping address where customer wishes to receive the device. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ReverseShippingDetailShippingAddress { get; set; } + /// Mobile number of the contact person. + string ReverseShippingDetailsContactDetailsMobile { get; set; } + /// Phone number of the contact person. + string ReverseShippingDetailsContactDetailsPhone { get; set; } + /// Phone extension number of the contact person. + string ReverseShippingDetailsContactDetailsPhoneExtension { get; set; } + /// Contact name of the person. + string ReverseShippingDetailsContactName { get; set; } + /// Name of the City. + string ReverseShippingDetailsShippingAddressCity { get; set; } + /// Name of the company. + string ReverseShippingDetailsShippingAddressCompanyName { get; set; } + /// Name of the Country. + string ReverseShippingDetailsShippingAddressCountry { get; set; } + /// Postal code. + string ReverseShippingDetailsShippingAddressPostalCode { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + bool? ReverseShippingDetailsShippingAddressSkipAddressValidation { get; set; } + /// Name of the State or Province. + string ReverseShippingDetailsShippingAddressStateOrProvince { get; set; } + /// Street Address line 1. + string ReverseShippingDetailsShippingAddressStreetAddress1 { get; set; } + /// Street Address line 2. + string ReverseShippingDetailsShippingAddressStreetAddress2 { get; set; } + /// Street Address line 3. + string ReverseShippingDetailsShippingAddressStreetAddress3 { get; set; } + /// Tax Identification Number + string ReverseShippingDetailsShippingAddressTaxIdentificationNumber { get; set; } + /// Type of address. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string ReverseShippingDetailsShippingAddressType { get; set; } + /// Extended Zip Code. + string ReverseShippingDetailsShippingAddressZipExtendedCode { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + bool? ReverseTransportPreferenceIsUpdated { get; set; } + /// Indicates Shipment Logistics type that the customer preferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string ReverseTransportPreferencePreferredShipmentType { get; set; } + /// Shipping address of the customer. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ShippingAddress { get; set; } + /// Type of address. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string ShippingAddressType { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + bool? SkipAddressValidation { get; set; } + /// Name of the State or Province. + string StateOrProvince { get; set; } + /// Street Address line 1. + string StreetAddress1 { get; set; } + /// Street Address line 2. + string StreetAddress2 { get; set; } + /// Street Address line 3. + string StreetAddress3 { get; set; } + /// Tax Identification Number + string TaxIdentificationNumber { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + bool? TransportPreferenceIsUpdated { get; set; } + /// Indicates Shipment Logistics type that the customer preferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string TransportPreferencePreferredShipmentType { get; set; } + /// Arm resource id for user assigned identity to be used to fetch MSI token. + string UserAssignedResourceId { get; set; } + /// Extended Zip Code. + string ZipExtendedCode { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.json.cs new file mode 100644 index 00000000000..c3d6958ca68 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job details for update. + public partial class UpdateJobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new UpdateJobDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._contactDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._contactDetail.ToJson(null,serializationMode) : null, "contactDetails" ,container.Add ); + AddIf( null != this._shippingAddress ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._shippingAddress.ToJson(null,serializationMode) : null, "shippingAddress" ,container.Add ); + AddIf( null != this._reverseShippingDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._reverseShippingDetail.ToJson(null,serializationMode) : null, "reverseShippingDetails" ,container.Add ); + AddIf( null != this._preference ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._preference.ToJson(null,serializationMode) : null, "preferences" ,container.Add ); + AddIf( null != this._keyEncryptionKey ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._keyEncryptionKey.ToJson(null,serializationMode) : null, "keyEncryptionKey" ,container.Add ); + AddIf( null != this._returnToCustomerPackageDetail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._returnToCustomerPackageDetail.ToJson(null,serializationMode) : null, "returnToCustomerPackageDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateJobDetails(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_contactDetail = If( json?.PropertyT("contactDetails"), out var __jsonContactDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ContactDetails.FromJson(__jsonContactDetails) : _contactDetail;} + {_shippingAddress = If( json?.PropertyT("shippingAddress"), out var __jsonShippingAddress) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress.FromJson(__jsonShippingAddress) : _shippingAddress;} + {_reverseShippingDetail = If( json?.PropertyT("reverseShippingDetails"), out var __jsonReverseShippingDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ReverseShippingDetails.FromJson(__jsonReverseShippingDetails) : _reverseShippingDetail;} + {_preference = If( json?.PropertyT("preferences"), out var __jsonPreferences) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.Preferences.FromJson(__jsonPreferences) : _preference;} + {_keyEncryptionKey = If( json?.PropertyT("keyEncryptionKey"), out var __jsonKeyEncryptionKey) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.KeyEncryptionKey.FromJson(__jsonKeyEncryptionKey) : _keyEncryptionKey;} + {_returnToCustomerPackageDetail = If( json?.PropertyT("returnToCustomerPackageDetails"), out var __jsonReturnToCustomerPackageDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.PackageCarrierDetails.FromJson(__jsonReturnToCustomerPackageDetails) : _returnToCustomerPackageDetail;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.PowerShell.cs new file mode 100644 index 00000000000..0da154b504e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Job Properties for update + [System.ComponentModel.TypeConverter(typeof(UpdateJobPropertiesTypeConverter))] + public partial class UpdateJobProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateJobProperties(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.DataBox.Models.IUpdateJobProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateJobProperties(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.DataBox.Models.IUpdateJobProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateJobProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobPropertiesInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobPropertiesInternal)this).Detail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UpdateJobDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateJobProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobPropertiesInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobPropertiesInternal)this).Detail, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UpdateJobDetailsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + } + /// Job Properties for update + [System.ComponentModel.TypeConverter(typeof(UpdateJobPropertiesTypeConverter))] + public partial interface IUpdateJobProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.TypeConverter.cs new file mode 100644 index 00000000000..366a076fd70 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateJobPropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateJobProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateJobProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateJobProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.cs new file mode 100644 index 00000000000..836354a86fc --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job Properties for update + public partial class UpdateJobProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails _detail; + + /// Details of a job to be updated. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails Detail { get => (this._detail = this._detail ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UpdateJobDetails()); set => this._detail = value; } + + /// Creates an new instance. + public UpdateJobProperties() + { + + } + } + /// Job Properties for update + public partial interface IUpdateJobProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Details of a job to be updated. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Details of a job to be updated.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails Detail { get; set; } + + } + /// Job Properties for update + internal partial interface IUpdateJobPropertiesInternal + + { + /// Details of a job to be updated. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails Detail { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.json.cs new file mode 100644 index 00000000000..bfb3052d809 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UpdateJobProperties.json.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Job Properties for update + public partial class UpdateJobProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new UpdateJobProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._detail ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._detail.ToJson(null,serializationMode) : null, "details" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateJobProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UpdateJobDetails.FromJson(__jsonDetails) : _detail;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.PowerShell.cs new file mode 100644 index 00000000000..35773028f38 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// User assigned identity properties + [System.ComponentModel.TypeConverter(typeof(UserAssignedIdentityTypeConverter))] + public partial class UserAssignedIdentity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UserAssignedIdentity(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.DataBox.Models.IUserAssignedIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UserAssignedIdentity(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.DataBox.Models.IUserAssignedIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UserAssignedIdentity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentityInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentityInternal)this).PrincipalId, global::System.Convert.ToString); + } + if (content.Contains("ClientId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentityInternal)this).ClientId = (string) content.GetValueForProperty("ClientId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentityInternal)this).ClientId, 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 UserAssignedIdentity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentityInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentityInternal)this).PrincipalId, global::System.Convert.ToString); + } + if (content.Contains("ClientId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentityInternal)this).ClientId = (string) content.GetValueForProperty("ClientId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentityInternal)this).ClientId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// User assigned identity properties + [System.ComponentModel.TypeConverter(typeof(UserAssignedIdentityTypeConverter))] + public partial interface IUserAssignedIdentity + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.TypeConverter.cs new file mode 100644 index 00000000000..cbbb81db433 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UserAssignedIdentityTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UserAssignedIdentity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UserAssignedIdentity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UserAssignedIdentity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.cs new file mode 100644 index 00000000000..6e005a8d1e5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// User assigned identity properties + public partial class UserAssignedIdentity : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentity, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentityInternal + { + + /// Backing field for property. + private string _clientId; + + /// The client ID of the assigned identity. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ClientId { get => this._clientId; } + + /// Internal Acessors for ClientId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentityInternal.ClientId { get => this._clientId; set { {_clientId = value;} } } + + /// Internal Acessors for PrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentityInternal.PrincipalId { get => this._principalId; set { {_principalId = value;} } } + + /// Backing field for property. + private string _principalId; + + /// The principal ID of the assigned identity. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string PrincipalId { get => this._principalId; } + + /// Creates an new instance. + public UserAssignedIdentity() + { + + } + } + /// User assigned identity properties + public partial interface IUserAssignedIdentity : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// The client ID of the assigned identity. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The client ID of the assigned identity.", + SerializedName = @"clientId", + PossibleTypes = new [] { typeof(string) })] + string ClientId { get; } + /// The principal ID of the assigned identity. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The principal ID of the assigned identity.", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string PrincipalId { get; } + + } + /// User assigned identity properties + internal partial interface IUserAssignedIdentityInternal + + { + /// The client ID of the assigned identity. + string ClientId { get; set; } + /// The principal ID of the assigned identity. + string PrincipalId { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.json.cs new file mode 100644 index 00000000000..0ae88454ac8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedIdentity.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// User assigned identity properties + public partial class UserAssignedIdentity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new UserAssignedIdentity(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._principalId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._principalId.ToString()) : null, "principalId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._clientId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._clientId.ToString()) : null, "clientId" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal UserAssignedIdentity(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_principalId = If( json?.PropertyT("principalId"), out var __jsonPrincipalId) ? (string)__jsonPrincipalId : (string)_principalId;} + {_clientId = If( json?.PropertyT("clientId"), out var __jsonClientId) ? (string)__jsonClientId : (string)_clientId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.PowerShell.cs new file mode 100644 index 00000000000..35f131b2c7a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// User assigned identity properties. + [System.ComponentModel.TypeConverter(typeof(UserAssignedPropertiesTypeConverter))] + public partial class UserAssignedProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UserAssignedProperties(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.DataBox.Models.IUserAssignedProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UserAssignedProperties(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.DataBox.Models.IUserAssignedProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UserAssignedProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedPropertiesInternal)this).ResourceId = (string) content.GetValueForProperty("ResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedPropertiesInternal)this).ResourceId, 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 UserAssignedProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedPropertiesInternal)this).ResourceId = (string) content.GetValueForProperty("ResourceId",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedPropertiesInternal)this).ResourceId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// User assigned identity properties. + [System.ComponentModel.TypeConverter(typeof(UserAssignedPropertiesTypeConverter))] + public partial interface IUserAssignedProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.TypeConverter.cs new file mode 100644 index 00000000000..69f9502e705 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UserAssignedPropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UserAssignedProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UserAssignedProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UserAssignedProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.cs new file mode 100644 index 00000000000..9b8f89cc2cb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// User assigned identity properties. + public partial class UserAssignedProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedPropertiesInternal + { + + /// Backing field for property. + private string _resourceId; + + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ResourceId { get => this._resourceId; set => this._resourceId = value; } + + /// Creates an new instance. + public UserAssignedProperties() + { + + } + } + /// User assigned identity properties. + public partial interface IUserAssignedProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Arm resource id for user assigned identity to be used to fetch MSI token. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Arm resource id for user assigned identity to be used to fetch MSI token.", + SerializedName = @"resourceId", + PossibleTypes = new [] { typeof(string) })] + string ResourceId { get; set; } + + } + /// User assigned identity properties. + internal partial interface IUserAssignedPropertiesInternal + + { + /// Arm resource id for user assigned identity to be used to fetch MSI token. + string ResourceId { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.json.cs new file mode 100644 index 00000000000..164917eb3c0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/UserAssignedProperties.json.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// User assigned identity properties. + public partial class UserAssignedProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUserAssignedProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new UserAssignedProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._resourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._resourceId.ToString()) : null, "resourceId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal UserAssignedProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_resourceId = If( json?.PropertyT("resourceId"), out var __jsonResourceId) ? (string)__jsonResourceId : (string)_resourceId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.PowerShell.cs new file mode 100644 index 00000000000..0d1102c885c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.PowerShell.cs @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// The requirements to validate customer address where the device needs to be shipped. + /// + [System.ComponentModel.TypeConverter(typeof(ValidateAddressTypeConverter))] + public partial class ValidateAddress + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ValidateAddress(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.DataBox.Models.IValidateAddress DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ValidateAddress(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.DataBox.Models.IValidateAddress FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ValidateAddress(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("TransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).TransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("TransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).TransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).DeviceType = (string) content.GetValueForProperty("DeviceType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).DeviceType, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).Model, global::System.Convert.ToString); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressCity = (string) content.GetValueForProperty("ShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStateOrProvince = (string) content.GetValueForProperty("ShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressCountry = (string) content.GetValueForProperty("ShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressPostalCode = (string) content.GetValueForProperty("ShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressCompanyName = (string) content.GetValueForProperty("ShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ValidateAddress(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ShippingAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddress = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress) content.GetValueForProperty("ShippingAddress",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddress, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddressTypeConverter.ConvertFrom); + } + if (content.Contains("TransportPreference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).TransportPreference = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences) content.GetValueForProperty("TransportPreference",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).TransportPreference, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferencesTypeConverter.ConvertFrom); + } + if (content.Contains("DeviceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).DeviceType = (string) content.GetValueForProperty("DeviceType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).DeviceType, global::System.Convert.ToString); + } + if (content.Contains("Model")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).Model = (string) content.GetValueForProperty("Model",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).Model, global::System.Convert.ToString); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressType = (string) content.GetValueForProperty("ShippingAddressType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressType, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStreetAddress1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStreetAddress1 = (string) content.GetValueForProperty("ShippingAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStreetAddress1, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStreetAddress2")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStreetAddress2 = (string) content.GetValueForProperty("ShippingAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStreetAddress2, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStreetAddress3")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStreetAddress3 = (string) content.GetValueForProperty("ShippingAddressStreetAddress3",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStreetAddress3, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressCity = (string) content.GetValueForProperty("ShippingAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressCity, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressStateOrProvince")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStateOrProvince = (string) content.GetValueForProperty("ShippingAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressStateOrProvince, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressCountry")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressCountry = (string) content.GetValueForProperty("ShippingAddressCountry",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressCountry, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressPostalCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressPostalCode = (string) content.GetValueForProperty("ShippingAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressPostalCode, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressZipExtendedCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressZipExtendedCode = (string) content.GetValueForProperty("ShippingAddressZipExtendedCode",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressZipExtendedCode, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressCompanyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressCompanyName = (string) content.GetValueForProperty("ShippingAddressCompanyName",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressCompanyName, global::System.Convert.ToString); + } + if (content.Contains("ShippingAddressSkipAddressValidation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressSkipAddressValidation = (bool?) content.GetValueForProperty("ShippingAddressSkipAddressValidation",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressSkipAddressValidation, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ShippingAddressTaxIdentificationNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressTaxIdentificationNumber = (string) content.GetValueForProperty("ShippingAddressTaxIdentificationNumber",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).ShippingAddressTaxIdentificationNumber, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferencePreferredShipmentType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).TransportPreferencePreferredShipmentType = (string) content.GetValueForProperty("TransportPreferencePreferredShipmentType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).TransportPreferencePreferredShipmentType, global::System.Convert.ToString); + } + if (content.Contains("TransportPreferenceIsUpdated")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).TransportPreferenceIsUpdated = (bool?) content.GetValueForProperty("TransportPreferenceIsUpdated",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal)this).TransportPreferenceIsUpdated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + } + /// The requirements to validate customer address where the device needs to be shipped. + [System.ComponentModel.TypeConverter(typeof(ValidateAddressTypeConverter))] + public partial interface IValidateAddress + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.TypeConverter.cs new file mode 100644 index 00000000000..5c146b87f6e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ValidateAddressTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ValidateAddress.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ValidateAddress.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ValidateAddress.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.cs new file mode 100644 index 00000000000..98e6fb843ed --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.cs @@ -0,0 +1,386 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// The requirements to validate customer address where the device needs to be shipped. + /// + public partial class ValidateAddress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest __validationInputRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest(); + + /// Backing field for property. + private string _deviceType; + + /// Device type to be used for the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string DeviceType { get => this._deviceType; set => this._deviceType = value; } + + /// Internal Acessors for ShippingAddress + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal.ShippingAddress { get => (this._shippingAddress = this._shippingAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress()); set { {_shippingAddress = value;} } } + + /// Internal Acessors for TransportPreference + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal.TransportPreference { get => (this._transportPreference = this._transportPreference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferences()); set { {_transportPreference = value;} } } + + /// Internal Acessors for TransportPreferenceIsUpdated + bool? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddressInternal.TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)TransportPreference).IsUpdated; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)TransportPreference).IsUpdated = value ?? default(bool); } + + /// Backing field for property. + private string _model; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Model { get => this._model; set => this._model = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress _shippingAddress; + + /// Shipping address of the customer. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ShippingAddress { get => (this._shippingAddress = this._shippingAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress()); set => this._shippingAddress = value; } + + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).City = value ?? null; } + + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressCompanyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).CompanyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).CompanyName = value ?? null; } + + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressCountry { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).Country = value ; } + + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).PostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).PostalCode = value ?? null; } + + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? ShippingAddressSkipAddressValidation { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).SkipAddressValidation; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).SkipAddressValidation = value ?? default(bool); } + + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StateOrProvince = value ?? null; } + + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress1 = value ; } + + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress2 = value ?? null; } + + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressStreetAddress3 { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress3; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).StreetAddress3 = value ?? null; } + + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressTaxIdentificationNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).TaxIdentificationNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).TaxIdentificationNumber = value ?? null; } + + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).AddressType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).AddressType = value ?? null; } + + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string ShippingAddressZipExtendedCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).ZipExtendedCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddressInternal)ShippingAddress).ZipExtendedCode = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences _transportPreference; + + /// Preferences related to the shipment logistics of the sku. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences TransportPreference { get => (this._transportPreference = this._transportPreference ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferences()); set => this._transportPreference = value; } + + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public bool? TransportPreferenceIsUpdated { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)TransportPreference).IsUpdated; } + + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string TransportPreferencePreferredShipmentType { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)TransportPreference).PreferredShipmentType; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferencesInternal)TransportPreference).PreferredShipmentType = value ?? null; } + + /// Identifies the type of validation request. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Constant] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inherited)] + public string ValidationType { get => "ValidateAddress"; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)__validationInputRequest).ValidationType = "ValidateAddress"; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__validationInputRequest), __validationInputRequest); + await eventListener.AssertObjectIsValid(nameof(__validationInputRequest), __validationInputRequest); + } + + /// Creates an new instance. + public ValidateAddress() + { + this.__validationInputRequest.ValidationType = "ValidateAddress"; + } + } + /// The requirements to validate customer address where the device needs to be shipped. + public partial interface IValidateAddress : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest + { + /// Device type to be used for the job. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Device type to be used for the job.", + SerializedName = @"deviceType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DeviceType { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Name of the City. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the City.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressCity { get; set; } + /// Name of the company. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the company.", + SerializedName = @"companyName", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressCompanyName { get; set; } + /// Name of the Country. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the Country.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressCountry { get; set; } + /// Postal code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Postal code.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressPostalCode { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Flag to indicate if customer has chosen to skip default address validation", + SerializedName = @"skipAddressValidation", + PossibleTypes = new [] { typeof(bool) })] + bool? ShippingAddressSkipAddressValidation { get; set; } + /// Name of the State or Province. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Name of the State or Province.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressStateOrProvince { get; set; } + /// Street Address line 1. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 1.", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressStreetAddress1 { get; set; } + /// Street Address line 2. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 2.", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressStreetAddress2 { get; set; } + /// Street Address line 3. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Street Address line 3.", + SerializedName = @"streetAddress3", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressStreetAddress3 { get; set; } + /// Tax Identification Number + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Tax Identification Number", + SerializedName = @"taxIdentificationNumber", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressTaxIdentificationNumber { get; set; } + /// Type of address. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Type of address.", + SerializedName = @"addressType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string ShippingAddressType { get; set; } + /// Extended Zip Code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Extended Zip Code.", + SerializedName = @"zipExtendedCode", + PossibleTypes = new [] { typeof(string) })] + string ShippingAddressZipExtendedCode { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Read only property which indicates whether transport preferences has been updated or not after device is prepared.", + SerializedName = @"isUpdated", + PossibleTypes = new [] { typeof(bool) })] + bool? TransportPreferenceIsUpdated { get; } + /// Indicates Shipment Logistics type that the customer preferred. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicates Shipment Logistics type that the customer preferred.", + SerializedName = @"preferredShipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string TransportPreferencePreferredShipmentType { get; set; } + + } + /// The requirements to validate customer address where the device needs to be shipped. + internal partial interface IValidateAddressInternal : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal + { + /// Device type to be used for the job. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + string DeviceType { get; set; } + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + string Model { get; set; } + /// Shipping address of the customer. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShippingAddress ShippingAddress { get; set; } + /// Name of the City. + string ShippingAddressCity { get; set; } + /// Name of the company. + string ShippingAddressCompanyName { get; set; } + /// Name of the Country. + string ShippingAddressCountry { get; set; } + /// Postal code. + string ShippingAddressPostalCode { get; set; } + /// Flag to indicate if customer has chosen to skip default address validation + bool? ShippingAddressSkipAddressValidation { get; set; } + /// Name of the State or Province. + string ShippingAddressStateOrProvince { get; set; } + /// Street Address line 1. + string ShippingAddressStreetAddress1 { get; set; } + /// Street Address line 2. + string ShippingAddressStreetAddress2 { get; set; } + /// Street Address line 3. + string ShippingAddressStreetAddress3 { get; set; } + /// Tax Identification Number + string ShippingAddressTaxIdentificationNumber { get; set; } + /// Type of address. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + string ShippingAddressType { get; set; } + /// Extended Zip Code. + string ShippingAddressZipExtendedCode { get; set; } + /// Preferences related to the shipment logistics of the sku. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITransportPreferences TransportPreference { get; set; } + /// + /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. + /// + bool? TransportPreferenceIsUpdated { get; set; } + /// Indicates Shipment Logistics type that the customer preferred. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + string TransportPreferencePreferredShipmentType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.json.cs new file mode 100644 index 00000000000..5b81a7dbbde --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidateAddress.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// The requirements to validate customer address where the device needs to be shipped. + /// + public partial class ValidateAddress + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ValidateAddress(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __validationInputRequest?.ToJson(container, serializationMode); + AddIf( null != this._shippingAddress ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._shippingAddress.ToJson(null,serializationMode) : null, "shippingAddress" ,container.Add ); + AddIf( null != this._transportPreference ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._transportPreference.ToJson(null,serializationMode) : null, "transportPreferences" ,container.Add ); + AddIf( null != (((object)this._deviceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._deviceType.ToString()) : null, "deviceType" ,container.Add ); + AddIf( null != (((object)this._model)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._model.ToString()) : null, "model" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ValidateAddress(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __validationInputRequest = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest(json); + {_shippingAddress = If( json?.PropertyT("shippingAddress"), out var __jsonShippingAddress) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShippingAddress.FromJson(__jsonShippingAddress) : _shippingAddress;} + {_transportPreference = If( json?.PropertyT("transportPreferences"), out var __jsonTransportPreferences) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.TransportPreferences.FromJson(__jsonTransportPreferences) : _transportPreference;} + {_deviceType = If( json?.PropertyT("deviceType"), out var __jsonDeviceType) ? (string)__jsonDeviceType : (string)_deviceType;} + {_model = If( json?.PropertyT("model"), out var __jsonModel) ? (string)__jsonModel : (string)_model;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.PowerShell.cs new file mode 100644 index 00000000000..020d33bc7af --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Minimum fields that must be present in any type of validation request. + [System.ComponentModel.TypeConverter(typeof(ValidationInputRequestTypeConverter))] + public partial class ValidationInputRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ValidationInputRequest(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.DataBox.Models.IValidationInputRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ValidationInputRequest(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.DataBox.Models.IValidationInputRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ValidationInputRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, 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 ValidationInputRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal)this).ValidationType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Minimum fields that must be present in any type of validation request. + [System.ComponentModel.TypeConverter(typeof(ValidationInputRequestTypeConverter))] + public partial interface IValidationInputRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.TypeConverter.cs new file mode 100644 index 00000000000..b7daa72a529 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ValidationInputRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ValidationInputRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ValidationInputRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ValidationInputRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.cs new file mode 100644 index 00000000000..c789985218f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Minimum fields that must be present in any type of validation request. + public partial class ValidationInputRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequestInternal + { + + /// Backing field for property. + private string _validationType; + + /// Identifies the type of validation request. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ValidationType { get => this._validationType; set => this._validationType = value; } + + /// Creates an new instance. + public ValidationInputRequest() + { + + } + } + /// Minimum fields that must be present in any type of validation request. + public partial interface IValidationInputRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Identifies the type of validation request. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Identifies the type of validation request.", + SerializedName = @"validationType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", "ValidateCreateOrderLimit", "ValidateSkuAvailability", "ValidateDataTransferDetails")] + string ValidationType { get; set; } + + } + /// Minimum fields that must be present in any type of validation request. + internal partial interface IValidationInputRequestInternal + + { + /// Identifies the type of validation request. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", "ValidateCreateOrderLimit", "ValidateSkuAvailability", "ValidateDataTransferDetails")] + string ValidationType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.json.cs new file mode 100644 index 00000000000..1cc03390d8a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputRequest.json.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Minimum fields that must be present in any type of validation request. + public partial class ValidationInputRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest interface is polymorphic, and the + /// precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("validationType") ) + { + case "ValidateAddress": + { + return new ValidateAddress(json); + } + case "ValidateCreateOrderLimit": + { + return new CreateOrderLimitForSubscriptionValidationRequest(json); + } + case "ValidateDataTransferDetails": + { + return new DataTransferDetailsValidationRequest(json); + } + case "ValidatePreferences": + { + return new PreferencesValidationRequest(json); + } + case "ValidateSkuAvailability": + { + return new SkuAvailabilityValidationRequest(json); + } + case "ValidateSubscriptionIsAllowedToCreateJob": + { + return new SubscriptionIsAllowedToCreateJobValidationRequest(json); + } + } + return new ValidationInputRequest(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._validationType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._validationType.ToString()) : null, "validationType" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ValidationInputRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_validationType = If( json?.PropertyT("validationType"), out var __jsonValidationType) ? (string)__jsonValidationType : (string)_validationType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.PowerShell.cs new file mode 100644 index 00000000000..76b92b6033e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.PowerShell.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// Minimum properties that should be present in each individual validation response. + /// + [System.ComponentModel.TypeConverter(typeof(ValidationInputResponseTypeConverter))] + public partial class ValidationInputResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ValidationInputResponse(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.DataBox.Models.IValidationInputResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ValidationInputResponse(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.DataBox.Models.IValidationInputResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ValidationInputResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, 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 ValidationInputResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ValidationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType = (string) content.GetValueForProperty("ValidationType",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).ValidationType, global::System.Convert.ToString); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AdditionalErrorInfo1TypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal)this).Target, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Minimum properties that should be present in each individual validation response. + [System.ComponentModel.TypeConverter(typeof(ValidationInputResponseTypeConverter))] + public partial interface IValidationInputResponse + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.TypeConverter.cs new file mode 100644 index 00000000000..fa73159da80 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ValidationInputResponseTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ValidationInputResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ValidationInputResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ValidationInputResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.cs new file mode 100644 index 00000000000..548d5244bd4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Minimum properties that should be present in each individual validation response. + /// + public partial class ValidationInputResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal + { + + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code; } + + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError _error; + + /// Error code and message of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError()); } + + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message; } + + /// Internal Acessors for AdditionalInfo + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).AdditionalInfo = value ?? null /* arrayOf */; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Code = value ?? null; } + + /// Internal Acessors for Detail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Detail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError()); set { {_error = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Message = value ?? null; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target = value ?? null; } + + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudErrorInternal)Error).Target; } + + /// Backing field for property. + private string _validationType; + + /// Identifies the type of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ValidationType { get => this._validationType; set => this._validationType = value; } + + /// Creates an new instance. + public ValidationInputResponse() + { + + } + } + /// Minimum properties that should be present in each individual validation response. + public partial interface IValidationInputResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// Gets or sets additional error info. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets additional error info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAdditionalErrorInfo1) })] + System.Collections.Generic.List AdditionalInfo { get; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// Gets or sets details for the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets details for the error.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError) })] + System.Collections.Generic.List Detail { get; } + /// The error message parsed from the body of the http error response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The error message parsed from the body of the http error response.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// Gets or sets the target of the error. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets or sets the target of the error.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + /// Identifies the type of validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Identifies the type of validation response.", + SerializedName = @"validationType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", "ValidateCreateOrderLimit", "ValidateSkuAvailability", "ValidateDataTransferDetails")] + string ValidationType { get; set; } + + } + /// Minimum properties that should be present in each individual validation response. + internal partial interface IValidationInputResponseInternal + + { + /// Gets or sets additional error info. + System.Collections.Generic.List AdditionalInfo { get; set; } + /// Error code. + string Code { get; set; } + /// Gets or sets details for the error. + System.Collections.Generic.List Detail { get; set; } + /// Error code and message of validation response. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICloudError Error { get; set; } + /// The error message parsed from the body of the http error response. + string Message { get; set; } + /// Gets or sets the target of the error. + string Target { get; set; } + /// Identifies the type of validation response. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", "ValidateCreateOrderLimit", "ValidateSkuAvailability", "ValidateDataTransferDetails")] + string ValidationType { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.json.cs new file mode 100644 index 00000000000..47ee0c9dfef --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationInputResponse.json.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// + /// Minimum properties that should be present in each individual validation response. + /// + public partial class ValidationInputResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse interface is polymorphic, and the + /// precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("validationType") ) + { + case "ValidateAddress": + { + return new AddressValidationProperties(json); + } + case "ValidateCreateOrderLimit": + { + return new CreateOrderLimitForSubscriptionValidationResponseProperties(json); + } + case "ValidateDataTransferDetails": + { + return new DataTransferDetailsValidationResponseProperties(json); + } + case "ValidatePreferences": + { + return new PreferencesValidationResponseProperties(json); + } + case "ValidateSkuAvailability": + { + return new SkuAvailabilityValidationResponseProperties(json); + } + case "ValidateSubscriptionIsAllowedToCreateJob": + { + return new SubscriptionIsAllowedToCreateJobValidationResponseProperties(json); + } + } + return new ValidationInputResponse(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + } + AddIf( null != (((object)this._validationType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._validationType.ToString()) : null, "validationType" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ValidationInputResponse(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CloudError.FromJson(__jsonError) : _error;} + {_validationType = If( json?.PropertyT("validationType"), out var __jsonValidationType) ? (string)__jsonValidationType : (string)_validationType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.PowerShell.cs new file mode 100644 index 00000000000..aab9def66f1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Minimum request requirement of any validation category. + [System.ComponentModel.TypeConverter(typeof(ValidationRequestTypeConverter))] + public partial class ValidationRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ValidationRequest(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.DataBox.Models.IValidationRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ValidationRequest(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.DataBox.Models.IValidationRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ValidationRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ValidationCategory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).ValidationCategory = (string) content.GetValueForProperty("ValidationCategory",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).ValidationCategory, global::System.Convert.ToString); + } + if (content.Contains("IndividualRequestDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).IndividualRequestDetail = (System.Collections.Generic.List) content.GetValueForProperty("IndividualRequestDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).IndividualRequestDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequestTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ValidationRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ValidationCategory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).ValidationCategory = (string) content.GetValueForProperty("ValidationCategory",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).ValidationCategory, global::System.Convert.ToString); + } + if (content.Contains("IndividualRequestDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).IndividualRequestDetail = (System.Collections.Generic.List) content.GetValueForProperty("IndividualRequestDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal)this).IndividualRequestDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequestTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// Minimum request requirement of any validation category. + [System.ComponentModel.TypeConverter(typeof(ValidationRequestTypeConverter))] + public partial interface IValidationRequest + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.TypeConverter.cs new file mode 100644 index 00000000000..7ae44626ffb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ValidationRequestTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ValidationRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ValidationRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ValidationRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.cs new file mode 100644 index 00000000000..f3cc9fab92e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Minimum request requirement of any validation category. + public partial class ValidationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _individualRequestDetail; + + /// + /// List of request details contain validationType and its request as key and value respectively. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List IndividualRequestDetail { get => this._individualRequestDetail; set => this._individualRequestDetail = value; } + + /// Internal Acessors for ValidationCategory + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequestInternal.ValidationCategory { get => this._validationCategory; set { {_validationCategory = value;} } } + + /// Backing field for property. + private string _validationCategory= @"JobCreationValidation"; + + /// Identify the nature of validation. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string ValidationCategory { get => this._validationCategory; } + + /// Creates an new instance. + public ValidationRequest() + { + + } + } + /// Minimum request requirement of any validation category. + public partial interface IValidationRequest : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// + /// List of request details contain validationType and its request as key and value respectively. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of request details contain validationType and its request as key and value respectively.", + SerializedName = @"individualRequestDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress) })] + System.Collections.Generic.List IndividualRequestDetail { get; set; } + /// Identify the nature of validation. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = true, + Read = true, + Create = true, + Update = true, + Description = @"Identify the nature of validation.", + SerializedName = @"validationCategory", + PossibleTypes = new [] { typeof(string) })] + string ValidationCategory { get; } + + } + /// Minimum request requirement of any validation category. + internal partial interface IValidationRequestInternal + + { + /// + /// List of request details contain validationType and its request as key and value respectively. + /// + System.Collections.Generic.List IndividualRequestDetail { get; set; } + /// Identify the nature of validation. + string ValidationCategory { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.json.cs new file mode 100644 index 00000000000..aa8591b8874 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationRequest.json.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Minimum request requirement of any validation category. + public partial class ValidationRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest interface is polymorphic, and the precise + /// model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("validationCategory") ) + { + case "JobCreationValidation": + { + return new CreateJobValidations(json); + } + } + return new ValidationRequest(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._validationCategory)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._validationCategory.ToString()) : null, "validationCategory" ,container.Add ); + if (null != this._individualRequestDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._individualRequestDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("individualRequestDetails",__w); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ValidationRequest(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_validationCategory = If( json?.PropertyT("validationCategory"), out var __jsonValidationCategory) ? (string)__jsonValidationCategory : (string)_validationCategory;} + {_individualRequestDetail = If( json?.PropertyT("individualRequestDetails"), out var __jsonIndividualRequestDetails) ? If( __jsonIndividualRequestDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IValidationInputRequest) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputRequest.FromJson(__u) )) ))() : null : _individualRequestDetail;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.PowerShell.cs new file mode 100644 index 00000000000..5fc7dc405c1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Response of pre job creation validations. + [System.ComponentModel.TypeConverter(typeof(ValidationResponseTypeConverter))] + public partial class ValidationResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ValidationResponse(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.DataBox.Models.IValidationResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ValidationResponse(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.DataBox.Models.IValidationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ValidationResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationResponsePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("IndividualResponseDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal)this).IndividualResponseDetail = (System.Collections.Generic.List) content.GetValueForProperty("IndividualResponseDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal)this).IndividualResponseDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponseTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ValidationResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationResponsePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("IndividualResponseDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal)this).IndividualResponseDetail = (System.Collections.Generic.List) content.GetValueForProperty("IndividualResponseDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal)this).IndividualResponseDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponseTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// Response of pre job creation validations. + [System.ComponentModel.TypeConverter(typeof(ValidationResponseTypeConverter))] + public partial interface IValidationResponse + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.TypeConverter.cs new file mode 100644 index 00000000000..9ca295e2888 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ValidationResponseTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ValidationResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ValidationResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ValidationResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.cs new file mode 100644 index 00000000000..17aa7436427 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Response of pre job creation validations. + public partial class ValidationResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal + { + + /// + /// List of response details contain validationType and its response as key and value respectively. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public System.Collections.Generic.List IndividualResponseDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)Property).IndividualResponseDetail; } + + /// Internal Acessors for IndividualResponseDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal.IndividualResponseDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)Property).IndividualResponseDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)Property).IndividualResponseDetail = value ?? null /* arrayOf */; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationResponseProperties()); set { {_property = value;} } } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)Property).Status = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties _property; + + /// Properties of pre job creation validation response. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationResponseProperties()); } + + /// Overall validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Inlined)] + public string Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)Property).Status; } + + /// Creates an new instance. + public ValidationResponse() + { + + } + } + /// Response of pre job creation validations. + public partial interface IValidationResponse : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// + /// List of response details contain validationType and its response as key and value respectively. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of response details contain validationType and its response as key and value respectively.", + SerializedName = @"individualResponseDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties) })] + System.Collections.Generic.List IndividualResponseDetail { get; } + /// Overall validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Overall validation status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("AllValidToProceed", "InputsRevisitRequired", "CertainInputValidationsSkipped")] + string Status { get; } + + } + /// Response of pre job creation validations. + internal partial interface IValidationResponseInternal + + { + /// + /// List of response details contain validationType and its response as key and value respectively. + /// + System.Collections.Generic.List IndividualResponseDetail { get; set; } + /// Properties of pre job creation validation response. + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties Property { get; set; } + /// Overall validation status. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("AllValidToProceed", "InputsRevisitRequired", "CertainInputValidationsSkipped")] + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.json.cs new file mode 100644 index 00000000000..33217d2bf8f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponse.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Response of pre job creation validations. + public partial class ValidationResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ValidationResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ValidationResponse(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationResponseProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.PowerShell.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.PowerShell.cs new file mode 100644 index 00000000000..bf45d393511 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// Properties of pre job creation validation response. + [System.ComponentModel.TypeConverter(typeof(ValidationResponsePropertiesTypeConverter))] + public partial class ValidationResponseProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ValidationResponseProperties(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.DataBox.Models.IValidationResponseProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ValidationResponseProperties(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.DataBox.Models.IValidationResponseProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ValidationResponseProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("IndividualResponseDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)this).IndividualResponseDetail = (System.Collections.Generic.List) content.GetValueForProperty("IndividualResponseDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)this).IndividualResponseDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponseTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ValidationResponseProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("IndividualResponseDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)this).IndividualResponseDetail = (System.Collections.Generic.List) content.GetValueForProperty("IndividualResponseDetail",((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal)this).IndividualResponseDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponseTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// Properties of pre job creation validation response. + [System.ComponentModel.TypeConverter(typeof(ValidationResponsePropertiesTypeConverter))] + public partial interface IValidationResponseProperties + + { + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.TypeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.TypeConverter.cs new file mode 100644 index 00000000000..d768007381a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.TypeConverter.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ValidationResponsePropertiesTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ValidationResponseProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ValidationResponseProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ValidationResponseProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.cs new file mode 100644 index 00000000000..7ae6fcde430 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of pre job creation validation response. + public partial class ValidationResponseProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _individualResponseDetail; + + /// + /// List of response details contain validationType and its response as key and value respectively. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public System.Collections.Generic.List IndividualResponseDetail { get => this._individualResponseDetail; } + + /// Internal Acessors for IndividualResponseDetail + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal.IndividualResponseDetail { get => this._individualResponseDetail; set { {_individualResponseDetail = value;} } } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponsePropertiesInternal.Status { get => this._status; set { {_status = value;} } } + + /// Backing field for property. + private string _status; + + /// Overall validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataBox.PropertyOrigin.Owned)] + public string Status { get => this._status; } + + /// Creates an new instance. + public ValidationResponseProperties() + { + + } + } + /// Properties of pre job creation validation response. + public partial interface IValidationResponseProperties : + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable + { + /// + /// List of response details contain validationType and its response as key and value respectively. + /// + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"List of response details contain validationType and its response as key and value respectively.", + SerializedName = @"individualResponseDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputResponse),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationProperties) })] + System.Collections.Generic.List IndividualResponseDetail { get; } + /// Overall validation status. + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Overall validation status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("AllValidToProceed", "InputsRevisitRequired", "CertainInputValidationsSkipped")] + string Status { get; } + + } + /// Properties of pre job creation validation response. + internal partial interface IValidationResponsePropertiesInternal + + { + /// + /// List of response details contain validationType and its response as key and value respectively. + /// + System.Collections.Generic.List IndividualResponseDetail { get; set; } + /// Overall validation status. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("AllValidToProceed", "InputsRevisitRequired", "CertainInputValidationsSkipped")] + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.json.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.json.cs new file mode 100644 index 00000000000..11985269581 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/api/Models/ValidationResponseProperties.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + /// Properties of pre job creation validation response. + public partial class ValidationResponseProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json 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 JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponseProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new ValidationResponseProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._individualResponseDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.XNodeArray(); + foreach( var __x in this._individualResponseDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("individualResponseDetails",__w); + } + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject instance to deserialize from. + internal ValidationResponseProperties(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} + {_individualResponseDetail = If( json?.PropertyT("individualResponseDetails"), out var __jsonIndividualResponseDetails) ? If( __jsonIndividualResponseDetails as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IValidationInputResponse) (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationInputResponse.FromJson(__u) )) ))() : null : _individualResponseDetail;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJobCredentials_List.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJobCredentials_List.cs new file mode 100644 index 00000000000..0207e100f48 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJobCredentials_List.cs @@ -0,0 +1,538 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// This method gets the unencrypted secrets related to the job. + /// + /// [OpenAPI] ListCredentials=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDataBoxJobCredentials_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUnencryptedCredentials))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method gets the unencrypted secrets related to the job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials", ApiVersion = "2025-07-01")] + public partial class GetAzDataBoxJobCredentials_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IUnencryptedCredentialsList + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzDataBoxJobCredentials_List() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsListCredentials' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsListCredentials(SubscriptionId, ResourceGroupName, JobName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IUnencryptedCredentialsList + /// 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.DataBox.Models.IUnencryptedCredentialsList + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + 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 (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsListCredentials_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_Get.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_Get.cs new file mode 100644 index 00000000000..7b4451cbdb9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_Get.cs @@ -0,0 +1,525 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Gets information about the specified job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDataBoxJob_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Gets information about the specified job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", ApiVersion = "2025-07-01")] + public partial class GetAzDataBoxJob_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _expand; + + /// + /// $expand is supported on details parameter for job, which provides details on the job stages. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "$expand is supported on details parameter for job, which provides details on the job stages.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"$expand is supported on details parameter for job, which provides details on the job stages.", + SerializedName = @"$expand", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Query)] + public string Expand { get => this._expand; set => this._expand = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IJobResource + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzDataBoxJob_Get() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsGet(SubscriptionId, ResourceGroupName, Name, this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IJobResource + /// 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.DataBox.Models.IJobResource + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_GetViaIdentity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_GetViaIdentity.cs new file mode 100644 index 00000000000..2b95b0b1e0a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_GetViaIdentity.cs @@ -0,0 +1,499 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Gets information about the specified job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDataBoxJob_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Gets information about the specified job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", ApiVersion = "2025-07-01")] + public partial class GetAzDataBoxJob_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _expand; + + /// + /// $expand is supported on details parameter for job, which provides details on the job stages. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "$expand is supported on details parameter for job, which provides details on the job stages.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"$expand is supported on details parameter for job, which provides details on the job stages.", + SerializedName = @"$expand", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Query)] + public string Expand { get => this._expand; set => this._expand = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IJobResource + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzDataBoxJob_GetViaIdentity() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.JobsGetViaIdentity(InputObject.Id, this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, onOk, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.JobsGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.JobName ?? null, this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IJobResource + /// 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.DataBox.Models.IJobResource + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_List.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_List.cs new file mode 100644 index 00000000000..99d7be350ee --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_List.cs @@ -0,0 +1,534 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Lists all the jobs available under the given resource group. + /// + /// [OpenAPI] ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDataBoxJob_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Lists all the jobs available under the given resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs", ApiVersion = "2025-07-01")] + public partial class GetAzDataBoxJob_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _skipToken; + + /// + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + SerializedName = @"$skipToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Query)] + public string SkipToken { get => this._skipToken; set => this._skipToken = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IJobResourceList + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzDataBoxJob_List() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsListByResourceGroup(SubscriptionId, ResourceGroupName, this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IJobResourceList + /// 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.DataBox.Models.IJobResourceList + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + 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 (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsListByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_List1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_List1.cs new file mode 100644 index 00000000000..dcd422a9a76 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxJob_List1.cs @@ -0,0 +1,520 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Lists all the jobs available under the subscription. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDataBoxJob_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Lists all the jobs available under the subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs", ApiVersion = "2025-07-01")] + public partial class GetAzDataBoxJob_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _skipToken; + + /// + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"$skipToken is supported on Get list of jobs, which provides the next page in the list of jobs.", + SerializedName = @"$skipToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Query)] + public string SkipToken { get => this._skipToken; set => this._skipToken = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IJobResourceList + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzDataBoxJob_List1() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsList(SubscriptionId, this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IJobResourceList + /// 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.DataBox.Models.IJobResourceList + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + 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 (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxOperation_List.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxOperation_List.cs new file mode 100644 index 00000000000..86e4770dd40 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxOperation_List.cs @@ -0,0 +1,483 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// List the operations for the provider + /// + /// [OpenAPI] List=>GET:"/providers/Microsoft.DataBox/operations" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDataBoxOperation_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IOperation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"List the operations for the provider")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/providers/Microsoft.DataBox/operations", ApiVersion = "2025-07-01")] + public partial class GetAzDataBoxOperation_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IOperationList + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzDataBoxOperation_List() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList(onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IOperationList + /// 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.DataBox.Models.IOperationList + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + 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 (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_List.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_List.cs new file mode 100644 index 00000000000..23e8bdd4f93 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_List.cs @@ -0,0 +1,551 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This method provides the list of available skus for the given subscription, resource group and location. + /// + /// + /// [OpenAPI] ListAvailableSkusByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDataBoxServiceAvailableSku_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method provides the list of available skus for the given subscription, resource group and location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus", ApiVersion = "2025-07-01")] + public partial class GetAzDataBoxServiceAvailableSku_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 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; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest _availableSkuRequest; + + /// The filters for showing the available skus. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The filters for showing the available skus.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The filters for showing the available skus.", + SerializedName = @"availableSkuRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest AvailableSkuRequest { get => this._availableSkuRequest; set => this._availableSkuRequest = value; } + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IAvailableSkusResult + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzDataBoxServiceAvailableSku_List() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceListAvailableSkusByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceListAvailableSkusByResourceGroup(SubscriptionId, ResourceGroupName, Location, AvailableSkuRequest, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IAvailableSkusResult + /// 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.DataBox.Models.IAvailableSkusResult + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + 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 (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceListAvailableSkusByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_ListExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_ListExpanded.cs new file mode 100644 index 00000000000..1dc54fda73c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_ListExpanded.cs @@ -0,0 +1,591 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This method provides the list of available skus for the given subscription, resource group and location. + /// + /// + /// [OpenAPI] ListAvailableSkusByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDataBoxServiceAvailableSku_ListExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method provides the list of available skus for the given subscription, resource group and location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus", ApiVersion = "2025-07-01")] + public partial class GetAzDataBoxServiceAvailableSku_ListExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 filters for showing the available skus. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAvailableSkuRequest _availableSkuRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.AvailableSkuRequest(); + + /// + /// 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 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.ClientAPI; + + /// + /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + public string Country { get => _availableSkuRequestBody.Country ?? null; set => _availableSkuRequestBody.Country = value; } + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location1 { get => _availableSkuRequestBody.Location ?? null; set => _availableSkuRequestBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Sku Names to filter for available skus + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sku Names to filter for available skus")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sku Names to filter for available skus", + SerializedName = @"skuNames", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string[] SkuName { get => _availableSkuRequestBody.SkuName?.ToArray() ?? null /* fixedArrayOf */; set => _availableSkuRequestBody.SkuName = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Type of the transfer. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Type of the transfer.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Type of the transfer.", + SerializedName = @"transferType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + public string TransferType { get => _availableSkuRequestBody.TransferType ?? null; set => _availableSkuRequestBody.TransferType = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IAvailableSkusResult + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzDataBoxServiceAvailableSku_ListExpanded() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceListAvailableSkusByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceListAvailableSkusByResourceGroup(SubscriptionId, ResourceGroupName, Location, _availableSkuRequestBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IAvailableSkusResult + /// 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.DataBox.Models.IAvailableSkusResult + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + 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 (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceListAvailableSkusByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_ListViaJsonFilePath.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_ListViaJsonFilePath.cs new file mode 100644 index 00000000000..0ed10514c31 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_ListViaJsonFilePath.cs @@ -0,0 +1,553 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This method provides the list of available skus for the given subscription, resource group and location. + /// + /// + /// [OpenAPI] ListAvailableSkusByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDataBoxServiceAvailableSku_ListViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method provides the list of available skus for the given subscription, resource group and location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class GetAzDataBoxServiceAvailableSku_ListViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 onOK call. + private bool _isFirst = true; + + public global::System.String _jsonString; + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 List operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the List operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the List 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; } } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IAvailableSkusResult + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzDataBoxServiceAvailableSku_ListViaJsonFilePath() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceListAvailableSkusByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceListAvailableSkusByResourceGroupViaJsonString(SubscriptionId, ResourceGroupName, Location, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IAvailableSkusResult + /// 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.DataBox.Models.IAvailableSkusResult + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + 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 (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceListAvailableSkusByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_ListViaJsonString.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_ListViaJsonString.cs new file mode 100644 index 00000000000..d016180fdab --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/GetAzDataBoxServiceAvailableSku_ListViaJsonString.cs @@ -0,0 +1,551 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This method provides the list of available skus for the given subscription, resource group and location. + /// + /// + /// [OpenAPI] ListAvailableSkusByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzDataBoxServiceAvailableSku_ListViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuInformation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method provides the list of available skus for the given subscription, resource group and location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class GetAzDataBoxServiceAvailableSku_ListViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 List operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the List operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the List operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IAvailableSkusResult + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzDataBoxServiceAvailableSku_ListViaJsonString() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceListAvailableSkusByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceListAvailableSkusByResourceGroupViaJsonString(SubscriptionId, ResourceGroupName, Location, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IAvailableSkusResult + /// 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.DataBox.Models.IAvailableSkusResult + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + 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 (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceListAvailableSkusByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_Book.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_Book.cs new file mode 100644 index 00000000000..510eff59f8d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_Book.cs @@ -0,0 +1,522 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Book shipment pick up. + /// + /// [OpenAPI] BookShipmentPickUp=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxBookJobShipmentPickUp_Book", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Book shipment pick up.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxBookJobShipmentPickUp_Book : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest _shipmentPickUpRequest; + + /// Shipment pick up request details. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Shipment pick up request details.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Shipment pick up request details.", + SerializedName = @"shipmentPickUpRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest ShipmentPickUpRequest { get => this._shipmentPickUpRequest; set => this._shipmentPickUpRequest = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IShipmentPickUpResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxBookJobShipmentPickUp_Book() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsBookShipmentPickUp' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsBookShipmentPickUp(SubscriptionId, ResourceGroupName, JobName, ShipmentPickUpRequest, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IShipmentPickUpResponse + /// 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.DataBox.Models.IShipmentPickUpResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookExpanded.cs new file mode 100644 index 00000000000..0106b6f6788 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookExpanded.cs @@ -0,0 +1,548 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Book shipment pick up. + /// + /// [OpenAPI] BookShipmentPickUp=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxBookJobShipmentPickUp_BookExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Book shipment pick up.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxBookJobShipmentPickUp_BookExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// Shipment pick up request details. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest _shipmentPickUpRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShipmentPickUpRequest(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// Maximum date before which the pick up should commence, this must be in local time of pick up area. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Maximum date before which the pick up should commence, this must be in local time of pick up area.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Maximum date before which the pick up should commence, this must be in local time of pick up area.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + public global::System.DateTime EndTime { get => _shipmentPickUpRequestBody.EndTime; set => _shipmentPickUpRequestBody.EndTime = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Shipment Location in the pickup place. Eg.front desk + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Shipment Location in the pickup place. Eg.front desk")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Shipment Location in the pickup place. Eg.front desk", + SerializedName = @"shipmentLocation", + PossibleTypes = new [] { typeof(string) })] + public string ShipmentLocation { get => _shipmentPickUpRequestBody.ShipmentLocation ?? null; set => _shipmentPickUpRequestBody.ShipmentLocation = value; } + + /// + /// Minimum date after which the pick up should commence, this must be in local time of pick up area. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Minimum date after which the pick up should commence, this must be in local time of pick up area.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Minimum date after which the pick up should commence, this must be in local time of pick up area.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + public global::System.DateTime StartTime { get => _shipmentPickUpRequestBody.StartTime; set => _shipmentPickUpRequestBody.StartTime = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IShipmentPickUpResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxBookJobShipmentPickUp_BookExpanded() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsBookShipmentPickUp' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsBookShipmentPickUp(SubscriptionId, ResourceGroupName, JobName, _shipmentPickUpRequestBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IShipmentPickUpResponse + /// 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.DataBox.Models.IShipmentPickUpResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaIdentity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaIdentity.cs new file mode 100644 index 00000000000..2375f0d1592 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaIdentity.cs @@ -0,0 +1,500 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Book shipment pick up. + /// + /// [OpenAPI] BookShipmentPickUp=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxBookJobShipmentPickUp_BookViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Book shipment pick up.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxBookJobShipmentPickUp_BookViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest _shipmentPickUpRequest; + + /// Shipment pick up request details. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Shipment pick up request details.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Shipment pick up request details.", + SerializedName = @"shipmentPickUpRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest ShipmentPickUpRequest { get => this._shipmentPickUpRequest; set => this._shipmentPickUpRequest = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IShipmentPickUpResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxBookJobShipmentPickUp_BookViaIdentity() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsBookShipmentPickUp' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.JobsBookShipmentPickUpViaIdentity(InputObject.Id, ShipmentPickUpRequest, onOk, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.JobsBookShipmentPickUp(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.JobName ?? null, ShipmentPickUpRequest, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IShipmentPickUpResponse + /// 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.DataBox.Models.IShipmentPickUpResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaIdentityExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaIdentityExpanded.cs new file mode 100644 index 00000000000..90dd775d0be --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaIdentityExpanded.cs @@ -0,0 +1,526 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Book shipment pick up. + /// + /// [OpenAPI] BookShipmentPickUp=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxBookJobShipmentPickUp_BookViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Book shipment pick up.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxBookJobShipmentPickUp_BookViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// Shipment pick up request details. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpRequest _shipmentPickUpRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ShipmentPickUpRequest(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// Maximum date before which the pick up should commence, this must be in local time of pick up area. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Maximum date before which the pick up should commence, this must be in local time of pick up area.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Maximum date before which the pick up should commence, this must be in local time of pick up area.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + public global::System.DateTime EndTime { get => _shipmentPickUpRequestBody.EndTime; set => _shipmentPickUpRequestBody.EndTime = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Shipment Location in the pickup place. Eg.front desk + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Shipment Location in the pickup place. Eg.front desk")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Shipment Location in the pickup place. Eg.front desk", + SerializedName = @"shipmentLocation", + PossibleTypes = new [] { typeof(string) })] + public string ShipmentLocation { get => _shipmentPickUpRequestBody.ShipmentLocation ?? null; set => _shipmentPickUpRequestBody.ShipmentLocation = value; } + + /// + /// Minimum date after which the pick up should commence, this must be in local time of pick up area. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Minimum date after which the pick up should commence, this must be in local time of pick up area.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Minimum date after which the pick up should commence, this must be in local time of pick up area.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + public global::System.DateTime StartTime { get => _shipmentPickUpRequestBody.StartTime; set => _shipmentPickUpRequestBody.StartTime = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IShipmentPickUpResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxBookJobShipmentPickUp_BookViaIdentityExpanded() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsBookShipmentPickUp' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.JobsBookShipmentPickUpViaIdentity(InputObject.Id, _shipmentPickUpRequestBody, onOk, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.JobsBookShipmentPickUp(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.JobName ?? null, _shipmentPickUpRequestBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IShipmentPickUpResponse + /// 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.DataBox.Models.IShipmentPickUpResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaJsonFilePath.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaJsonFilePath.cs new file mode 100644 index 00000000000..591b43d17b6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaJsonFilePath.cs @@ -0,0 +1,524 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Book shipment pick up. + /// + /// [OpenAPI] BookShipmentPickUp=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxBookJobShipmentPickUp_BookViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Book shipment pick up.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class InvokeAzDataBoxBookJobShipmentPickUp_BookViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Book operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Book operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Book 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.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IShipmentPickUpResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxBookJobShipmentPickUp_BookViaJsonFilePath() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsBookShipmentPickUp' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsBookShipmentPickUpViaJsonString(SubscriptionId, ResourceGroupName, JobName, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IShipmentPickUpResponse + /// 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.DataBox.Models.IShipmentPickUpResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaJsonString.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaJsonString.cs new file mode 100644 index 00000000000..df8117ff115 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxBookJobShipmentPickUp_BookViaJsonString.cs @@ -0,0 +1,522 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Book shipment pick up. + /// + /// [OpenAPI] BookShipmentPickUp=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxBookJobShipmentPickUp_BookViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IShipmentPickUpResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Book shipment pick up.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class InvokeAzDataBoxBookJobShipmentPickUp_BookViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Book operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Book operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Book 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.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IShipmentPickUpResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxBookJobShipmentPickUp_BookViaJsonString() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsBookShipmentPickUp' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsBookShipmentPickUpViaJsonString(SubscriptionId, ResourceGroupName, JobName, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IShipmentPickUpResponse + /// 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.DataBox.Models.IShipmentPickUpResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_Mark.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_Mark.cs new file mode 100644 index 00000000000..7c8f3e02f5c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_Mark.cs @@ -0,0 +1,509 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Request to mark devices for a given job as shipped + /// + /// [OpenAPI] MarkDevicesShipped=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxMarkJobDeviceShipped_Mark", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Request to mark devices for a given job as shipped")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxMarkJobDeviceShipped_Mark : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest _markDevicesShippedRequest; + + /// The request body to provide the delivery package details of job + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The request body to provide the delivery package details of job", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The request body to provide the delivery package details of job", + SerializedName = @"markDevicesShippedRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest MarkDevicesShippedRequest { get => this._markDevicesShippedRequest; set => this._markDevicesShippedRequest = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxMarkJobDeviceShipped_Mark() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsMarkDevicesShipped' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsMarkDevicesShipped(SubscriptionId, ResourceGroupName, JobName, MarkDevicesShippedRequest, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkExpanded.cs new file mode 100644 index 00000000000..265a4d0e1ae --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkExpanded.cs @@ -0,0 +1,520 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Request to mark devices for a given job as shipped + /// + /// [OpenAPI] MarkDevicesShipped=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxMarkJobDeviceShipped_MarkExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Request to mark devices for a given job as shipped")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxMarkJobDeviceShipped_MarkExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// The request body to provide the delivery package details of job + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest _markDevicesShippedRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.MarkDevicesShippedRequest(); + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Name of the carrier. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Name of the carrier.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the carrier.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + public string DeliverToDcPackageDetailCarrierName { get => _markDevicesShippedRequestBody.DeliverToDcPackageDetailCarrierName ?? null; set => _markDevicesShippedRequestBody.DeliverToDcPackageDetailCarrierName = value; } + + /// Tracking Id of shipment. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Tracking Id of shipment.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tracking Id of shipment.", + SerializedName = @"trackingId", + PossibleTypes = new [] { typeof(string) })] + public string DeliverToDcPackageDetailTrackingId { get => _markDevicesShippedRequestBody.DeliverToDcPackageDetailTrackingId ?? null; set => _markDevicesShippedRequestBody.DeliverToDcPackageDetailTrackingId = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxMarkJobDeviceShipped_MarkExpanded() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsMarkDevicesShipped' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsMarkDevicesShipped(SubscriptionId, ResourceGroupName, JobName, _markDevicesShippedRequestBody, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaIdentity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaIdentity.cs new file mode 100644 index 00000000000..0258551a2b0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaIdentity.cs @@ -0,0 +1,487 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Request to mark devices for a given job as shipped + /// + /// [OpenAPI] MarkDevicesShipped=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxMarkJobDeviceShipped_MarkViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Request to mark devices for a given job as shipped")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxMarkJobDeviceShipped_MarkViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest _markDevicesShippedRequest; + + /// The request body to provide the delivery package details of job + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The request body to provide the delivery package details of job", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The request body to provide the delivery package details of job", + SerializedName = @"markDevicesShippedRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest MarkDevicesShippedRequest { get => this._markDevicesShippedRequest; set => this._markDevicesShippedRequest = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// 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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxMarkJobDeviceShipped_MarkViaIdentity() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsMarkDevicesShipped' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.JobsMarkDevicesShippedViaIdentity(InputObject.Id, MarkDevicesShippedRequest, onNoContent, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.JobsMarkDevicesShipped(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.JobName ?? null, MarkDevicesShippedRequest, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaIdentityExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaIdentityExpanded.cs new file mode 100644 index 00000000000..54042bc823b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaIdentityExpanded.cs @@ -0,0 +1,498 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Request to mark devices for a given job as shipped + /// + /// [OpenAPI] MarkDevicesShipped=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxMarkJobDeviceShipped_MarkViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Request to mark devices for a given job as shipped")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxMarkJobDeviceShipped_MarkViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// The request body to provide the delivery package details of job + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMarkDevicesShippedRequest _markDevicesShippedRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.MarkDevicesShippedRequest(); + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Name of the carrier. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Name of the carrier.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the carrier.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + public string DeliverToDcPackageDetailCarrierName { get => _markDevicesShippedRequestBody.DeliverToDcPackageDetailCarrierName ?? null; set => _markDevicesShippedRequestBody.DeliverToDcPackageDetailCarrierName = value; } + + /// Tracking Id of shipment. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Tracking Id of shipment.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tracking Id of shipment.", + SerializedName = @"trackingId", + PossibleTypes = new [] { typeof(string) })] + public string DeliverToDcPackageDetailTrackingId { get => _markDevicesShippedRequestBody.DeliverToDcPackageDetailTrackingId ?? null; set => _markDevicesShippedRequestBody.DeliverToDcPackageDetailTrackingId = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// 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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxMarkJobDeviceShipped_MarkViaIdentityExpanded() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsMarkDevicesShipped' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.JobsMarkDevicesShippedViaIdentity(InputObject.Id, _markDevicesShippedRequestBody, onNoContent, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.JobsMarkDevicesShipped(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.JobName ?? null, _markDevicesShippedRequestBody, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaJsonFilePath.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaJsonFilePath.cs new file mode 100644 index 00000000000..b45d964b34c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaJsonFilePath.cs @@ -0,0 +1,511 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Request to mark devices for a given job as shipped + /// + /// [OpenAPI] MarkDevicesShipped=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxMarkJobDeviceShipped_MarkViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Request to mark devices for a given job as shipped")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class InvokeAzDataBoxMarkJobDeviceShipped_MarkViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Mark operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Mark operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Mark 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.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxMarkJobDeviceShipped_MarkViaJsonFilePath() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsMarkDevicesShipped' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsMarkDevicesShippedViaJsonString(SubscriptionId, ResourceGroupName, JobName, _jsonString, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaJsonString.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaJsonString.cs new file mode 100644 index 00000000000..57842658f36 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMarkJobDeviceShipped_MarkViaJsonString.cs @@ -0,0 +1,509 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Request to mark devices for a given job as shipped + /// + /// [OpenAPI] MarkDevicesShipped=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxMarkJobDeviceShipped_MarkViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Request to mark devices for a given job as shipped")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class InvokeAzDataBoxMarkJobDeviceShipped_MarkViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Mark operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Mark operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Mark 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.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxMarkJobDeviceShipped_MarkViaJsonString() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsMarkDevicesShipped' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsMarkDevicesShippedViaJsonString(SubscriptionId, ResourceGroupName, JobName, _jsonString, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_Mitigate.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_Mitigate.cs new file mode 100644 index 00000000000..ee01feb51fa --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_Mitigate.cs @@ -0,0 +1,509 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Request to mitigate for a given job + /// + /// [OpenAPI] Mitigate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxMitigate_Mitigate", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Request to mitigate for a given job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxMitigate_Mitigate : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest _mitigateJobRequest; + + /// The Mitigate Job captured from request body for Mitigate API + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Mitigate Job captured from request body for Mitigate API", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Mitigate Job captured from request body for Mitigate API", + SerializedName = @"mitigateJobRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest MitigateJobRequest { get => this._mitigateJobRequest; set => this._mitigateJobRequest = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxMitigate_Mitigate() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'Mitigate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.Mitigate(SubscriptionId, ResourceGroupName, JobName, MitigateJobRequest, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateExpanded.cs new file mode 100644 index 00000000000..f532dbdb168 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateExpanded.cs @@ -0,0 +1,524 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Request to mitigate for a given job + /// + /// [OpenAPI] Mitigate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxMitigate_MitigateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Request to mitigate for a given job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxMitigate_MitigateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// The Mitigate Job captured from request body for Mitigate API + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest _mitigateJobRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.MitigateJobRequest(); + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.ClientAPI; + + /// Resolution code for the job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resolution code for the job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resolution code for the job", + SerializedName = @"customerResolutionCode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + public string CustomerResolutionCode { get => _mitigateJobRequestBody.CustomerResolutionCode ?? null; set => _mitigateJobRequestBody.CustomerResolutionCode = value; } + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// + /// Serial number and the customer resolution code corresponding to each serial number + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Serial number and the customer resolution code corresponding to each serial number")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Serial number and the customer resolution code corresponding to each serial number", + SerializedName = @"serialNumberCustomerResolutionMap", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap) })] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap SerialNumberCustomerResolutionMap { get => _mitigateJobRequestBody.SerialNumberCustomerResolutionMap ?? null /* object */; set => _mitigateJobRequestBody.SerialNumberCustomerResolutionMap = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxMitigate_MitigateExpanded() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'Mitigate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.Mitigate(SubscriptionId, ResourceGroupName, JobName, _mitigateJobRequestBody, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaIdentity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaIdentity.cs new file mode 100644 index 00000000000..4f9ed8e3274 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaIdentity.cs @@ -0,0 +1,487 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Request to mitigate for a given job + /// + /// [OpenAPI] Mitigate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxMitigate_MitigateViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Request to mitigate for a given job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxMitigate_MitigateViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest _mitigateJobRequest; + + /// The Mitigate Job captured from request body for Mitigate API + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Mitigate Job captured from request body for Mitigate API", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Mitigate Job captured from request body for Mitigate API", + SerializedName = @"mitigateJobRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest MitigateJobRequest { get => this._mitigateJobRequest; set => this._mitigateJobRequest = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// 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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxMitigate_MitigateViaIdentity() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'Mitigate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.MitigateViaIdentity(InputObject.Id, MitigateJobRequest, onNoContent, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.Mitigate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.JobName ?? null, MitigateJobRequest, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaIdentityExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaIdentityExpanded.cs new file mode 100644 index 00000000000..75370d1e626 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaIdentityExpanded.cs @@ -0,0 +1,502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Request to mitigate for a given job + /// + /// [OpenAPI] Mitigate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxMitigate_MitigateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Request to mitigate for a given job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxMitigate_MitigateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// The Mitigate Job captured from request body for Mitigate API + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequest _mitigateJobRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.MitigateJobRequest(); + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.ClientAPI; + + /// Resolution code for the job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resolution code for the job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resolution code for the job", + SerializedName = @"customerResolutionCode", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "MoveToCleanUpDevice", "Resume", "Restart", "ReachOutToOperation")] + public string CustomerResolutionCode { get => _mitigateJobRequestBody.CustomerResolutionCode ?? null; set => _mitigateJobRequestBody.CustomerResolutionCode = value; } + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// Serial number and the customer resolution code corresponding to each serial number + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Serial number and the customer resolution code corresponding to each serial number")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Serial number and the customer resolution code corresponding to each serial number", + SerializedName = @"serialNumberCustomerResolutionMap", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap) })] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IMitigateJobRequestSerialNumberCustomerResolutionMap SerialNumberCustomerResolutionMap { get => _mitigateJobRequestBody.SerialNumberCustomerResolutionMap ?? null /* object */; set => _mitigateJobRequestBody.SerialNumberCustomerResolutionMap = 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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxMitigate_MitigateViaIdentityExpanded() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'Mitigate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.MitigateViaIdentity(InputObject.Id, _mitigateJobRequestBody, onNoContent, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.Mitigate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.JobName ?? null, _mitigateJobRequestBody, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaJsonFilePath.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaJsonFilePath.cs new file mode 100644 index 00000000000..e190ff8c996 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaJsonFilePath.cs @@ -0,0 +1,511 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Request to mitigate for a given job + /// + /// [OpenAPI] Mitigate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxMitigate_MitigateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Request to mitigate for a given job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class InvokeAzDataBoxMitigate_MitigateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Mitigate operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Mitigate operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Mitigate 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.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxMitigate_MitigateViaJsonFilePath() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'Mitigate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MitigateViaJsonString(SubscriptionId, ResourceGroupName, JobName, _jsonString, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaJsonString.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaJsonString.cs new file mode 100644 index 00000000000..f73a64e3997 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxMitigate_MitigateViaJsonString.cs @@ -0,0 +1,509 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Request to mitigate for a given job + /// + /// [OpenAPI] Mitigate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxMitigate_MitigateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Request to mitigate for a given job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class InvokeAzDataBoxMitigate_MitigateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _jobName; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Mitigate operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Mitigate operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Mitigate 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.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxMitigate_MitigateViaJsonString() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'Mitigate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MitigateViaJsonString(SubscriptionId, ResourceGroupName, JobName, _jsonString, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_Region.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_Region.cs new file mode 100644 index 00000000000..6ece3509616 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_Region.cs @@ -0,0 +1,507 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// + /// [OpenAPI] RegionConfiguration=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxRegionServiceConfiguration_Region", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This API provides configuration details specific to given region/location at Subscription level.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxRegionServiceConfiguration_Region : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest _regionConfigurationRequest; + + /// Request body to get the configuration for the region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Request body to get the configuration for the region.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Request body to get the configuration for the region.", + SerializedName = @"regionConfigurationRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest RegionConfigurationRequest { get => this._regionConfigurationRequest; set => this._regionConfigurationRequest = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxRegionServiceConfiguration_Region() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceRegionConfiguration' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceRegionConfiguration(SubscriptionId, Location, RegionConfigurationRequest, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Models.IRegionConfigurationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_Region1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_Region1.cs new file mode 100644 index 00000000000..fda1e73fa57 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_Region1.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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// + /// [OpenAPI] RegionConfigurationByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxRegionServiceConfiguration_Region1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This API provides configuration details specific to given region/location at Resource group level.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxRegionServiceConfiguration_Region1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest _regionConfigurationRequest; + + /// Request body to get the configuration for the region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Request body to get the configuration for the region.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Request body to get the configuration for the region.", + SerializedName = @"regionConfigurationRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest RegionConfigurationRequest { get => this._regionConfigurationRequest; set => this._regionConfigurationRequest = value; } + + /// 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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxRegionServiceConfiguration_Region1() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceRegionConfigurationByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceRegionConfigurationByResourceGroup(SubscriptionId, ResourceGroupName, Location, RegionConfigurationRequest, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Models.IRegionConfigurationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionExpanded.cs new file mode 100644 index 00000000000..33da8524c22 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionExpanded.cs @@ -0,0 +1,641 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// + /// [OpenAPI] RegionConfiguration=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxRegionServiceConfiguration_RegionExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This API provides configuration details specific to given region/location at Subscription level.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxRegionServiceConfiguration_RegionExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// Request body to get the configuration for the region. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest _regionConfigurationRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.RegionConfigurationRequest(); + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.ClientAPI; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string DatacenterAddressRequestModel { get => _regionConfigurationRequestBody.DatacenterAddressRequestModel ?? null; set => _regionConfigurationRequestBody.DatacenterAddressRequestModel = value; } + + /// Sku Name for which the data center address requested. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sku Name for which the data center address requested.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sku Name for which the data center address requested.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string DatacenterAddressRequestSkuName { get => _regionConfigurationRequestBody.DatacenterAddressRequestSkuName ?? null; set => _regionConfigurationRequestBody.DatacenterAddressRequestSkuName = value; } + + /// + /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"storageLocation", + PossibleTypes = new [] { typeof(string) })] + public string DatacenterAddressRequestStorageLocation { get => _regionConfigurationRequestBody.DatacenterAddressRequestStorageLocation ?? null; set => _regionConfigurationRequestBody.DatacenterAddressRequestStorageLocation = value; } + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string DeviceCapabilityRequestModel { get => _regionConfigurationRequestBody.DeviceCapabilityRequestModel ?? null; set => _regionConfigurationRequestBody.DeviceCapabilityRequestModel = value; } + + /// Type of the device. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Type of the device.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of the device.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string DeviceCapabilityRequestSkuName { get => _regionConfigurationRequestBody.DeviceCapabilityRequestSkuName ?? null; set => _regionConfigurationRequestBody.DeviceCapabilityRequestSkuName = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Country in which storage location should be supported. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Country in which storage location should be supported.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Country in which storage location should be supported.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + public string ScheduleAvailabilityRequestCountry { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestCountry ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestCountry = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string ScheduleAvailabilityRequestModel { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestModel ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestModel = value; } + + /// Sku Name for which the order is to be scheduled. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sku Name for which the order is to be scheduled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sku Name for which the order is to be scheduled.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string ScheduleAvailabilityRequestSkuName { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestSkuName ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestSkuName = value; } + + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"storageLocation", + PossibleTypes = new [] { typeof(string) })] + public string ScheduleAvailabilityRequestStorageLocation { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestStorageLocation ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestStorageLocation = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string TransportAvailabilityRequestModel { get => _regionConfigurationRequestBody.TransportAvailabilityRequestModel ?? null; set => _regionConfigurationRequestBody.TransportAvailabilityRequestModel = value; } + + /// Type of the device. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Type of the device.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of the device.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string TransportAvailabilityRequestSkuName { get => _regionConfigurationRequestBody.TransportAvailabilityRequestSkuName ?? null; set => _regionConfigurationRequestBody.TransportAvailabilityRequestSkuName = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxRegionServiceConfiguration_RegionExpanded() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceRegionConfiguration' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceRegionConfiguration(SubscriptionId, Location, _regionConfigurationRequestBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Models.IRegionConfigurationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionExpanded1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionExpanded1.cs new file mode 100644 index 00000000000..98dc1f146cd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionExpanded1.cs @@ -0,0 +1,655 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// + /// [OpenAPI] RegionConfigurationByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxRegionServiceConfiguration_RegionExpanded1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This API provides configuration details specific to given region/location at Resource group level.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxRegionServiceConfiguration_RegionExpanded1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// Request body to get the configuration for the region. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest _regionConfigurationRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.RegionConfigurationRequest(); + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.ClientAPI; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string DatacenterAddressRequestModel { get => _regionConfigurationRequestBody.DatacenterAddressRequestModel ?? null; set => _regionConfigurationRequestBody.DatacenterAddressRequestModel = value; } + + /// Sku Name for which the data center address requested. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sku Name for which the data center address requested.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sku Name for which the data center address requested.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string DatacenterAddressRequestSkuName { get => _regionConfigurationRequestBody.DatacenterAddressRequestSkuName ?? null; set => _regionConfigurationRequestBody.DatacenterAddressRequestSkuName = value; } + + /// + /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"storageLocation", + PossibleTypes = new [] { typeof(string) })] + public string DatacenterAddressRequestStorageLocation { get => _regionConfigurationRequestBody.DatacenterAddressRequestStorageLocation ?? null; set => _regionConfigurationRequestBody.DatacenterAddressRequestStorageLocation = value; } + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string DeviceCapabilityRequestModel { get => _regionConfigurationRequestBody.DeviceCapabilityRequestModel ?? null; set => _regionConfigurationRequestBody.DeviceCapabilityRequestModel = value; } + + /// Type of the device. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Type of the device.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of the device.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string DeviceCapabilityRequestSkuName { get => _regionConfigurationRequestBody.DeviceCapabilityRequestSkuName ?? null; set => _regionConfigurationRequestBody.DeviceCapabilityRequestSkuName = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Country in which storage location should be supported. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Country in which storage location should be supported.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Country in which storage location should be supported.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + public string ScheduleAvailabilityRequestCountry { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestCountry ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestCountry = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string ScheduleAvailabilityRequestModel { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestModel ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestModel = value; } + + /// Sku Name for which the order is to be scheduled. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sku Name for which the order is to be scheduled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sku Name for which the order is to be scheduled.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string ScheduleAvailabilityRequestSkuName { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestSkuName ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestSkuName = value; } + + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"storageLocation", + PossibleTypes = new [] { typeof(string) })] + public string ScheduleAvailabilityRequestStorageLocation { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestStorageLocation ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestStorageLocation = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string TransportAvailabilityRequestModel { get => _regionConfigurationRequestBody.TransportAvailabilityRequestModel ?? null; set => _regionConfigurationRequestBody.TransportAvailabilityRequestModel = value; } + + /// Type of the device. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Type of the device.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of the device.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string TransportAvailabilityRequestSkuName { get => _regionConfigurationRequestBody.TransportAvailabilityRequestSkuName ?? null; set => _regionConfigurationRequestBody.TransportAvailabilityRequestSkuName = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxRegionServiceConfiguration_RegionExpanded1() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceRegionConfigurationByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceRegionConfigurationByResourceGroup(SubscriptionId, ResourceGroupName, Location, _regionConfigurationRequestBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Models.IRegionConfigurationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentity.cs new file mode 100644 index 00000000000..36ce7c6089a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentity.cs @@ -0,0 +1,498 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// + /// [OpenAPI] RegionConfiguration=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxRegionServiceConfiguration_RegionViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This API provides configuration details specific to given region/location at Subscription level.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest _regionConfigurationRequest; + + /// Request body to get the configuration for the region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Request body to get the configuration for the region.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Request body to get the configuration for the region.", + SerializedName = @"regionConfigurationRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest RegionConfigurationRequest { get => this._regionConfigurationRequest; set => this._regionConfigurationRequest = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentity() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceRegionConfiguration' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ServiceRegionConfigurationViaIdentity(InputObject.Id, RegionConfigurationRequest, onOk, onDefault, this, Pipeline); + } + 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.Location) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Location"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ServiceRegionConfiguration(InputObject.SubscriptionId ?? null, InputObject.Location ?? null, RegionConfigurationRequest, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Models.IRegionConfigurationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentity1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentity1.cs new file mode 100644 index 00000000000..fcbc5034600 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentity1.cs @@ -0,0 +1,502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// + /// [OpenAPI] RegionConfigurationByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxRegionServiceConfiguration_RegionViaIdentity1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This API provides configuration details specific to given region/location at Resource group level.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentity1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest _regionConfigurationRequest; + + /// Request body to get the configuration for the region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Request body to get the configuration for the region.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Request body to get the configuration for the region.", + SerializedName = @"regionConfigurationRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest RegionConfigurationRequest { get => this._regionConfigurationRequest; set => this._regionConfigurationRequest = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentity1() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceRegionConfigurationByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ServiceRegionConfigurationByResourceGroupViaIdentity(InputObject.Id, RegionConfigurationRequest, onOk, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.Location) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Location"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ServiceRegionConfigurationByResourceGroup(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.Location ?? null, RegionConfigurationRequest, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Models.IRegionConfigurationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded.cs new file mode 100644 index 00000000000..f8ad57fcfef --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded.cs @@ -0,0 +1,633 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// + /// [OpenAPI] RegionConfiguration=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This API provides configuration details specific to given region/location at Subscription level.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// Request body to get the configuration for the region. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest _regionConfigurationRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.RegionConfigurationRequest(); + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.ClientAPI; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string DatacenterAddressRequestModel { get => _regionConfigurationRequestBody.DatacenterAddressRequestModel ?? null; set => _regionConfigurationRequestBody.DatacenterAddressRequestModel = value; } + + /// Sku Name for which the data center address requested. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sku Name for which the data center address requested.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sku Name for which the data center address requested.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string DatacenterAddressRequestSkuName { get => _regionConfigurationRequestBody.DatacenterAddressRequestSkuName ?? null; set => _regionConfigurationRequestBody.DatacenterAddressRequestSkuName = value; } + + /// + /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"storageLocation", + PossibleTypes = new [] { typeof(string) })] + public string DatacenterAddressRequestStorageLocation { get => _regionConfigurationRequestBody.DatacenterAddressRequestStorageLocation ?? null; set => _regionConfigurationRequestBody.DatacenterAddressRequestStorageLocation = value; } + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string DeviceCapabilityRequestModel { get => _regionConfigurationRequestBody.DeviceCapabilityRequestModel ?? null; set => _regionConfigurationRequestBody.DeviceCapabilityRequestModel = value; } + + /// Type of the device. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Type of the device.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of the device.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string DeviceCapabilityRequestSkuName { get => _regionConfigurationRequestBody.DeviceCapabilityRequestSkuName ?? null; set => _regionConfigurationRequestBody.DeviceCapabilityRequestSkuName = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Country in which storage location should be supported. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Country in which storage location should be supported.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Country in which storage location should be supported.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + public string ScheduleAvailabilityRequestCountry { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestCountry ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestCountry = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string ScheduleAvailabilityRequestModel { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestModel ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestModel = value; } + + /// Sku Name for which the order is to be scheduled. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sku Name for which the order is to be scheduled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sku Name for which the order is to be scheduled.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string ScheduleAvailabilityRequestSkuName { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestSkuName ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestSkuName = value; } + + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"storageLocation", + PossibleTypes = new [] { typeof(string) })] + public string ScheduleAvailabilityRequestStorageLocation { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestStorageLocation ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestStorageLocation = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string TransportAvailabilityRequestModel { get => _regionConfigurationRequestBody.TransportAvailabilityRequestModel ?? null; set => _regionConfigurationRequestBody.TransportAvailabilityRequestModel = value; } + + /// Type of the device. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Type of the device.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of the device.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string TransportAvailabilityRequestSkuName { get => _regionConfigurationRequestBody.TransportAvailabilityRequestSkuName ?? null; set => _regionConfigurationRequestBody.TransportAvailabilityRequestSkuName = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceRegionConfiguration' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ServiceRegionConfigurationViaIdentity(InputObject.Id, _regionConfigurationRequestBody, onOk, onDefault, this, Pipeline); + } + 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.Location) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Location"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ServiceRegionConfiguration(InputObject.SubscriptionId ?? null, InputObject.Location ?? null, _regionConfigurationRequestBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Models.IRegionConfigurationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded1.cs new file mode 100644 index 00000000000..ec144de5be8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded1.cs @@ -0,0 +1,637 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// + /// [OpenAPI] RegionConfigurationByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This API provides configuration details specific to given region/location at Resource group level.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", ApiVersion = "2025-07-01")] + public partial class InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// Request body to get the configuration for the region. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationRequest _regionConfigurationRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.RegionConfigurationRequest(); + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.ClientAPI; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string DatacenterAddressRequestModel { get => _regionConfigurationRequestBody.DatacenterAddressRequestModel ?? null; set => _regionConfigurationRequestBody.DatacenterAddressRequestModel = value; } + + /// Sku Name for which the data center address requested. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sku Name for which the data center address requested.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sku Name for which the data center address requested.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string DatacenterAddressRequestSkuName { get => _regionConfigurationRequestBody.DatacenterAddressRequestSkuName ?? null; set => _regionConfigurationRequestBody.DatacenterAddressRequestSkuName = value; } + + /// + /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"storageLocation", + PossibleTypes = new [] { typeof(string) })] + public string DatacenterAddressRequestStorageLocation { get => _regionConfigurationRequestBody.DatacenterAddressRequestStorageLocation ?? null; set => _regionConfigurationRequestBody.DatacenterAddressRequestStorageLocation = value; } + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string DeviceCapabilityRequestModel { get => _regionConfigurationRequestBody.DeviceCapabilityRequestModel ?? null; set => _regionConfigurationRequestBody.DeviceCapabilityRequestModel = value; } + + /// Type of the device. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Type of the device.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of the device.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string DeviceCapabilityRequestSkuName { get => _regionConfigurationRequestBody.DeviceCapabilityRequestSkuName ?? null; set => _regionConfigurationRequestBody.DeviceCapabilityRequestSkuName = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Country in which storage location should be supported. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Country in which storage location should be supported.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Country in which storage location should be supported.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + public string ScheduleAvailabilityRequestCountry { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestCountry ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestCountry = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string ScheduleAvailabilityRequestModel { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestModel ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestModel = value; } + + /// Sku Name for which the order is to be scheduled. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sku Name for which the order is to be scheduled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sku Name for which the order is to be scheduled.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string ScheduleAvailabilityRequestSkuName { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestSkuName ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestSkuName = value; } + + /// + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01", + SerializedName = @"storageLocation", + PossibleTypes = new [] { typeof(string) })] + public string ScheduleAvailabilityRequestStorageLocation { get => _regionConfigurationRequestBody.ScheduleAvailabilityRequestStorageLocation ?? null; set => _regionConfigurationRequestBody.ScheduleAvailabilityRequestStorageLocation = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string TransportAvailabilityRequestModel { get => _regionConfigurationRequestBody.TransportAvailabilityRequestModel ?? null; set => _regionConfigurationRequestBody.TransportAvailabilityRequestModel = value; } + + /// Type of the device. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Type of the device.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of the device.", + SerializedName = @"skuName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string TransportAvailabilityRequestSkuName { get => _regionConfigurationRequestBody.TransportAvailabilityRequestSkuName ?? null; set => _regionConfigurationRequestBody.TransportAvailabilityRequestSkuName = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public InvokeAzDataBoxRegionServiceConfiguration_RegionViaIdentityExpanded1() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceRegionConfigurationByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ServiceRegionConfigurationByResourceGroupViaIdentity(InputObject.Id, _regionConfigurationRequestBody, onOk, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.Location) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Location"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ServiceRegionConfigurationByResourceGroup(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.Location ?? null, _regionConfigurationRequestBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Models.IRegionConfigurationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath.cs new file mode 100644 index 00000000000..9390372a433 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath.cs @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// + /// [OpenAPI] RegionConfiguration=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This API provides configuration details specific to given region/location at Subscription level.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Region operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Region operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Region 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; } } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceRegionConfiguration' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceRegionConfigurationViaJsonString(SubscriptionId, Location, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Models.IRegionConfigurationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath1.cs new file mode 100644 index 00000000000..489b5470fee --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath1.cs @@ -0,0 +1,524 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// + /// [OpenAPI] RegionConfigurationByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This API provides configuration details specific to given region/location at Resource group level.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Region operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Region operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Region 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; } } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonFilePath1() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceRegionConfigurationByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceRegionConfigurationByResourceGroupViaJsonString(SubscriptionId, ResourceGroupName, Location, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Models.IRegionConfigurationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonString.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonString.cs new file mode 100644 index 00000000000..ee488f6e041 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonString.cs @@ -0,0 +1,508 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// + /// [OpenAPI] RegionConfiguration=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxRegionServiceConfiguration_RegionViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This API provides configuration details specific to given region/location at Subscription level.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Region operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Region operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Region operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonString() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceRegionConfiguration' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceRegionConfigurationViaJsonString(SubscriptionId, Location, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Models.IRegionConfigurationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonString1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonString1.cs new file mode 100644 index 00000000000..12588911daf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonString1.cs @@ -0,0 +1,522 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// + /// [OpenAPI] RegionConfigurationByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzDataBoxRegionServiceConfiguration_RegionViaJsonString1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IRegionConfigurationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This API provides configuration details specific to given region/location at Resource group level.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonString1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Region operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Region operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Region operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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"); + } + } + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public InvokeAzDataBoxRegionServiceConfiguration_RegionViaJsonString1() + { + + } + + /// 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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceRegionConfigurationByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceRegionConfigurationByResourceGroupViaJsonString(SubscriptionId, ResourceGroupName, Location, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IRegionConfigurationResponse + /// 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.DataBox.Models.IRegionConfigurationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/NewAzDataBoxJob_CreateExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/NewAzDataBoxJob_CreateExpanded.cs new file mode 100644 index 00000000000..26e7e378904 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/NewAzDataBoxJob_CreateExpanded.cs @@ -0,0 +1,723 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// create a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated + /// with the create job API. + /// + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzDataBoxJob_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"create a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the create job API.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", ApiVersion = "2025-07-01")] + public partial class NewAzDataBoxJob_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + + /// Job Resource. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource _jobResourceBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResource(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Scheduled date time. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Scheduled date time.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Scheduled date time.", + SerializedName = @"scheduledDateTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + public global::System.DateTime DeliveryInfoScheduledDateTime { get => _jobResourceBody.DeliveryInfoScheduledDateTime ?? default(global::System.DateTime); set => _jobResourceBody.DeliveryInfoScheduledDateTime = value; } + + /// Delivery type of Job. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Delivery type of Job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Delivery type of Job.", + SerializedName = @"deliveryType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("NonScheduled", "Scheduled")] + public string DeliveryType { get => _jobResourceBody.DeliveryType ?? null; set => _jobResourceBody.DeliveryType = value; } + + /// Details of a job run. This field will only be sent for expand details filter. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Details of a job run. This field will only be sent for expand details filter.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Details of a job run. This field will only be sent for expand details filter.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxCustomerDiskJobDetails),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxDiskJobDetails),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxHeavyJobDetails),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxJobDetails) })] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobDetails Detail { get => _jobResourceBody.Detail ?? null /* object */; set => _jobResourceBody.Detail = value; } + + /// Determines whether to enable a system-assigned identity for the resource. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Determines whether to enable a system-assigned identity for the resource.")] + public global::System.Management.Automation.SwitchParameter EnableSystemAssignedIdentity { set => _jobResourceBody.IdentityType = value.IsPresent ? "SystemAssigned": null ; } + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _jobResourceBody.Location ?? null; set => _jobResourceBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// The display name of the sku. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The display name of the sku.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The display name of the sku.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + public string SkuDisplayName { get => _jobResourceBody.SkuDisplayName ?? null; set => _jobResourceBody.SkuDisplayName = value; } + + /// The sku family. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The sku family.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The sku family.", + SerializedName = @"family", + PossibleTypes = new [] { typeof(string) })] + public string SkuFamily { get => _jobResourceBody.SkuFamily ?? null; set => _jobResourceBody.SkuFamily = value; } + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string SkuModel { get => _jobResourceBody.SkuModel ?? null; set => _jobResourceBody.SkuModel = value; } + + /// The sku name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The sku name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The sku name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string SkuName { get => _jobResourceBody.SkuName ?? null; set => _jobResourceBody.SkuName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ITrackedResourceTags Tag { get => _jobResourceBody.Tag ?? null /* object */; set => _jobResourceBody.Tag = value; } + + /// Type of the data transfer. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Type of the data transfer.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Type of the data transfer.", + SerializedName = @"transferType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ImportToAzure", "ExportFromAzure")] + public string TransferType { get => _jobResourceBody.TransferType ?? null; set => _jobResourceBody.TransferType = value; } + + /// + /// The array of user assigned identities associated with the resource. The elements in array will be ARM resource ids in + /// the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.' + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The array of user assigned identities associated with the resource. The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.'")] + [global::System.Management.Automation.AllowEmptyCollection] + public string[] UserAssignedIdentity { get; set; } + + /// + /// 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IJobResource + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzDataBoxJob_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets.NewAzDataBoxJob_CreateExpanded Clone() + { + var clone = new NewAzDataBoxJob_CreateExpanded(); + 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._jobResourceBody = this._jobResourceBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 NewAzDataBoxJob_CreateExpanded() + { + + } + + private void PreProcessManagedIdentityParameters() + { + if (this.UserAssignedIdentity?.Length > 0) + { + // calculate UserAssignedIdentity + _jobResourceBody.IdentityUserAssignedIdentity.Clear(); + foreach( var id in this.UserAssignedIdentity ) + { + _jobResourceBody.IdentityUserAssignedIdentity.Add(id, new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedIdentity()); + } + } + // calculate IdentityType + if (this.UserAssignedIdentity?.Length > 0) + { + if ("SystemAssigned".Equals(_jobResourceBody.IdentityType, StringComparison.InvariantCultureIgnoreCase)) + { + _jobResourceBody.IdentityType = "SystemAssigned,UserAssigned"; + } + else + { + _jobResourceBody.IdentityType = "UserAssigned"; + } + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + this.PreProcessManagedIdentityParameters(); + await this.Client.JobsCreate(SubscriptionId, ResourceGroupName, Name, _jobResourceBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeCreate); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IJobResource + /// 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.DataBox.Models.IJobResource + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/NewAzDataBoxJob_CreateViaJsonFilePath.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/NewAzDataBoxJob_CreateViaJsonFilePath.cs new file mode 100644 index 00000000000..d60b3a749cb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/NewAzDataBoxJob_CreateViaJsonFilePath.cs @@ -0,0 +1,580 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// create a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated + /// with the create job API. + /// + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzDataBoxJob_CreateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"create a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the create job API.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class NewAzDataBoxJob_CreateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + + public global::System.String _jsonString; + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IJobResource + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzDataBoxJob_CreateViaJsonFilePath + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets.NewAzDataBoxJob_CreateViaJsonFilePath Clone() + { + var clone = new NewAzDataBoxJob_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() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 NewAzDataBoxJob_CreateViaJsonFilePath() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsCreateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IJobResource + /// 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.DataBox.Models.IJobResource + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/NewAzDataBoxJob_CreateViaJsonString.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/NewAzDataBoxJob_CreateViaJsonString.cs new file mode 100644 index 00000000000..3017d4216ea --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/NewAzDataBoxJob_CreateViaJsonString.cs @@ -0,0 +1,578 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// create a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated + /// with the create job API. + /// + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzDataBoxJob_CreateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"create a new job with the specified parameters. Existing job cannot be updated with this API and should instead be updated with the create job API.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class NewAzDataBoxJob_CreateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IJobResource + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzDataBoxJob_CreateViaJsonString + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets.NewAzDataBoxJob_CreateViaJsonString Clone() + { + var clone = new NewAzDataBoxJob_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() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 NewAzDataBoxJob_CreateViaJsonString() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsCreateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IJobResource + /// 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.DataBox.Models.IJobResource + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/RemoveAzDataBoxJob_Delete.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/RemoveAzDataBoxJob_Delete.cs new file mode 100644 index 00000000000..6ba9d679deb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/RemoveAzDataBoxJob_Delete.cs @@ -0,0 +1,598 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Deletes a job. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzDataBoxJob_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Deletes a job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", ApiVersion = "2025-07-01")] + public partial class RemoveAzDataBoxJob_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, 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. + /// /// 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, 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzDataBoxJob_Delete + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets.RemoveAzDataBoxJob_Delete Clone() + { + var clone = new RemoveAzDataBoxJob_Delete(); + 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; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsDelete(SubscriptionId, ResourceGroupName, Name, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzDataBoxJob_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/RemoveAzDataBoxJob_DeleteViaIdentity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/RemoveAzDataBoxJob_DeleteViaIdentity.cs new file mode 100644 index 00000000000..150e832c165 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/RemoveAzDataBoxJob_DeleteViaIdentity.cs @@ -0,0 +1,572 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// Deletes a job. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzDataBoxJob_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"Deletes a job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", ApiVersion = "2025-07-01")] + public partial class RemoveAzDataBoxJob_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// 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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, 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. + /// /// 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, 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzDataBoxJob_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets.RemoveAzDataBoxJob_DeleteViaIdentity Clone() + { + var clone = new RemoveAzDataBoxJob_DeleteViaIdentity(); + 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; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.JobsDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.JobsDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.JobName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzDataBoxJob_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_Cancel.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_Cancel.cs new file mode 100644 index 00000000000..55dbb85200a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_Cancel.cs @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// CancelJob. + /// + /// [OpenAPI] Cancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzDataBoxJob_Cancel", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"CancelJob.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel", ApiVersion = "2025-07-01")] + public partial class StopAzDataBoxJob_Cancel : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason _cancellationReason; + + /// Reason for cancellation. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Reason for cancellation.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Reason for cancellation.", + SerializedName = @"cancellationReason", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason CancellationReason { get => this._cancellationReason; set => this._cancellationReason = value; } + + /// 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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsCancel' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsCancel(SubscriptionId, ResourceGroupName, Name, CancellationReason, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public StopAzDataBoxJob_Cancel() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelExpanded.cs new file mode 100644 index 00000000000..d0fb15fd07a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelExpanded.cs @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// CancelJob. + /// + /// [OpenAPI] Cancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzDataBoxJob_CancelExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"CancelJob.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel", ApiVersion = "2025-07-01")] + public partial class StopAzDataBoxJob_CancelExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// Reason for cancellation. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason _cancellationReasonBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CancellationReason(); + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Reason for cancellation. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Reason for cancellation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Reason for cancellation.", + SerializedName = @"reason", + PossibleTypes = new [] { typeof(string) })] + public string Reason { get => _cancellationReasonBody.Reason ?? null; set => _cancellationReasonBody.Reason = value; } + + /// 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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsCancel' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsCancel(SubscriptionId, ResourceGroupName, Name, _cancellationReasonBody, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public StopAzDataBoxJob_CancelExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaIdentity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaIdentity.cs new file mode 100644 index 00000000000..960cd56c742 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaIdentity.cs @@ -0,0 +1,487 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// CancelJob. + /// + /// [OpenAPI] Cancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzDataBoxJob_CancelViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"CancelJob.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel", ApiVersion = "2025-07-01")] + public partial class StopAzDataBoxJob_CancelViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason _cancellationReason; + + /// Reason for cancellation. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Reason for cancellation.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Reason for cancellation.", + SerializedName = @"cancellationReason", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason CancellationReason { get => this._cancellationReason; set => this._cancellationReason = value; } + + /// 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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// 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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsCancel' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.JobsCancelViaIdentity(InputObject.Id, CancellationReason, onNoContent, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.JobsCancel(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.JobName ?? null, CancellationReason, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public StopAzDataBoxJob_CancelViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaIdentityExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaIdentityExpanded.cs new file mode 100644 index 00000000000..78e81e16e5f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaIdentityExpanded.cs @@ -0,0 +1,487 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// CancelJob. + /// + /// [OpenAPI] Cancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzDataBoxJob_CancelViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"CancelJob.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel", ApiVersion = "2025-07-01")] + public partial class StopAzDataBoxJob_CancelViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// Reason for cancellation. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICancellationReason _cancellationReasonBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.CancellationReason(); + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Reason for cancellation. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Reason for cancellation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Reason for cancellation.", + SerializedName = @"reason", + PossibleTypes = new [] { typeof(string) })] + public string Reason { get => _cancellationReasonBody.Reason ?? null; set => _cancellationReasonBody.Reason = 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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsCancel' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.JobsCancelViaIdentity(InputObject.Id, _cancellationReasonBody, onNoContent, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.JobsCancel(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.JobName ?? null, _cancellationReasonBody, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public StopAzDataBoxJob_CancelViaIdentityExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaJsonFilePath.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaJsonFilePath.cs new file mode 100644 index 00000000000..3f3ad3e9433 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaJsonFilePath.cs @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// CancelJob. + /// + /// [OpenAPI] Cancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzDataBoxJob_CancelViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"CancelJob.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class StopAzDataBoxJob_CancelViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Cancel operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Cancel operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Cancel 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.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsCancel' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsCancelViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public StopAzDataBoxJob_CancelViaJsonFilePath() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaJsonString.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaJsonString.cs new file mode 100644 index 00000000000..03215b6d534 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/StopAzDataBoxJob_CancelViaJsonString.cs @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// CancelJob. + /// + /// [OpenAPI] Cancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzDataBoxJob_CancelViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"CancelJob.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class StopAzDataBoxJob_CancelViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Cancel operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Cancel operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Cancel 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.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsCancel' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsCancelViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public StopAzDataBoxJob_CancelViaJsonString() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / application/json + if (true == InvocationInformation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_Validate.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_Validate.cs new file mode 100644 index 00000000000..ade7822ee2e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_Validate.cs @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide + /// alternate addresses if any. + /// + /// + /// [OpenAPI] ValidateAddress=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceAddress_Validate", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutput))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress", ApiVersion = "2025-07-01")] + public partial class TestAzDataBoxServiceAddress_Validate : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress _validateAddress; + + /// + /// The requirements to validate customer address where the device needs to be shipped. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The requirements to validate customer address where the device needs to be shipped.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The requirements to validate customer address where the device needs to be shipped.", + SerializedName = @"validateAddress", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress ValidateAddress { get => this._validateAddress; set => this._validateAddress = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IAddressValidationOutput + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateAddress' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceValidateAddress(SubscriptionId, Location, ValidateAddress, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceAddress_Validate() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IAddressValidationOutput + /// 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.DataBox.Models.IAddressValidationOutput + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateExpanded.cs new file mode 100644 index 00000000000..0906b12d1d3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateExpanded.cs @@ -0,0 +1,683 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide + /// alternate addresses if any. + /// + /// + /// [OpenAPI] ValidateAddress=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceAddress_ValidateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutput))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress", ApiVersion = "2025-07-01")] + public partial class TestAzDataBoxServiceAddress_ValidateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// + /// The requirements to validate customer address where the device needs to be shipped. + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress _validateAddressBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidateAddress(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Device type to be used for the job. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Device type to be used for the job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Device type to be used for the job.", + SerializedName = @"deviceType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string DeviceType { get => _validateAddressBody.DeviceType ?? null; set => _validateAddressBody.DeviceType = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string Model { get => _validateAddressBody.Model ?? null; set => _validateAddressBody.Model = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Name of the City. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Name of the City.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the City.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressCity { get => _validateAddressBody.ShippingAddressCity ?? null; set => _validateAddressBody.ShippingAddressCity = value; } + + /// Name of the company. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Name of the company.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the company.", + SerializedName = @"companyName", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressCompanyName { get => _validateAddressBody.ShippingAddressCompanyName ?? null; set => _validateAddressBody.ShippingAddressCompanyName = value; } + + /// Name of the Country. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the Country.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the Country.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressCountry { get => _validateAddressBody.ShippingAddressCountry ?? null; set => _validateAddressBody.ShippingAddressCountry = value; } + + /// Postal code. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Postal code.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Postal code.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressPostalCode { get => _validateAddressBody.ShippingAddressPostalCode ?? null; set => _validateAddressBody.ShippingAddressPostalCode = value; } + + /// Flag to indicate if customer has chosen to skip default address validation + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Flag to indicate if customer has chosen to skip default address validation")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Flag to indicate if customer has chosen to skip default address validation", + SerializedName = @"skipAddressValidation", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter ShippingAddressSkipAddressValidation { get => _validateAddressBody.ShippingAddressSkipAddressValidation ?? default(global::System.Management.Automation.SwitchParameter); set => _validateAddressBody.ShippingAddressSkipAddressValidation = value; } + + /// Name of the State or Province. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Name of the State or Province.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the State or Province.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressStateOrProvince { get => _validateAddressBody.ShippingAddressStateOrProvince ?? null; set => _validateAddressBody.ShippingAddressStateOrProvince = value; } + + /// Street Address line 1. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Street Address line 1.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Street Address line 1.", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressStreetAddress1 { get => _validateAddressBody.ShippingAddressStreetAddress1 ?? null; set => _validateAddressBody.ShippingAddressStreetAddress1 = value; } + + /// Street Address line 2. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Street Address line 2.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Street Address line 2.", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressStreetAddress2 { get => _validateAddressBody.ShippingAddressStreetAddress2 ?? null; set => _validateAddressBody.ShippingAddressStreetAddress2 = value; } + + /// Street Address line 3. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Street Address line 3.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Street Address line 3.", + SerializedName = @"streetAddress3", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressStreetAddress3 { get => _validateAddressBody.ShippingAddressStreetAddress3 ?? null; set => _validateAddressBody.ShippingAddressStreetAddress3 = value; } + + /// Tax Identification Number + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Tax Identification Number")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tax Identification Number", + SerializedName = @"taxIdentificationNumber", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressTaxIdentificationNumber { get => _validateAddressBody.ShippingAddressTaxIdentificationNumber ?? null; set => _validateAddressBody.ShippingAddressTaxIdentificationNumber = value; } + + /// Type of address. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Type of address.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of address.", + SerializedName = @"addressType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + public string ShippingAddressType { get => _validateAddressBody.ShippingAddressType ?? null; set => _validateAddressBody.ShippingAddressType = value; } + + /// Extended Zip Code. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Extended Zip Code.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Extended Zip Code.", + SerializedName = @"zipExtendedCode", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressZipExtendedCode { get => _validateAddressBody.ShippingAddressZipExtendedCode ?? null; set => _validateAddressBody.ShippingAddressZipExtendedCode = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Indicates Shipment Logistics type that the customer preferred. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates Shipment Logistics type that the customer preferred.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates Shipment Logistics type that the customer preferred.", + SerializedName = @"preferredShipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + public string TransportPreferencePreferredShipmentType { get => _validateAddressBody.TransportPreferencePreferredShipmentType ?? null; set => _validateAddressBody.TransportPreferencePreferredShipmentType = value; } + + /// Identifies the type of validation request. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identifies the type of validation request.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Identifies the type of validation request.", + SerializedName = @"validationType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", "ValidateCreateOrderLimit", "ValidateSkuAvailability", "ValidateDataTransferDetails")] + public string ValidationType { get => _validateAddressBody.ValidationType ?? null; set => _validateAddressBody.ValidationType = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IAddressValidationOutput + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateAddress' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceValidateAddress(SubscriptionId, Location, _validateAddressBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceAddress_ValidateExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IAddressValidationOutput + /// 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.DataBox.Models.IAddressValidationOutput + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaIdentity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaIdentity.cs new file mode 100644 index 00000000000..28f526e5f76 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaIdentity.cs @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide + /// alternate addresses if any. + /// + /// + /// [OpenAPI] ValidateAddress=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceAddress_ValidateViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutput))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress", ApiVersion = "2025-07-01")] + public partial class TestAzDataBoxServiceAddress_ValidateViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress _validateAddress; + + /// + /// The requirements to validate customer address where the device needs to be shipped. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The requirements to validate customer address where the device needs to be shipped.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The requirements to validate customer address where the device needs to be shipped.", + SerializedName = @"validateAddress", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress ValidateAddress { get => this._validateAddress; set => this._validateAddress = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IAddressValidationOutput + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateAddress' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ServiceValidateAddressViaIdentity(InputObject.Id, ValidateAddress, onOk, onDefault, this, Pipeline); + } + 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.Location) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Location"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ServiceValidateAddress(InputObject.SubscriptionId ?? null, InputObject.Location ?? null, ValidateAddress, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceAddress_ValidateViaIdentity() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IAddressValidationOutput + /// 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.DataBox.Models.IAddressValidationOutput + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaIdentityExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaIdentityExpanded.cs new file mode 100644 index 00000000000..d31cb17417f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaIdentityExpanded.cs @@ -0,0 +1,674 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide + /// alternate addresses if any. + /// + /// + /// [OpenAPI] ValidateAddress=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceAddress_ValidateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutput))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress", ApiVersion = "2025-07-01")] + public partial class TestAzDataBoxServiceAddress_ValidateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// + /// The requirements to validate customer address where the device needs to be shipped. + /// + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress _validateAddressBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidateAddress(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Device type to be used for the job. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Device type to be used for the job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Device type to be used for the job.", + SerializedName = @"deviceType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk")] + public string DeviceType { get => _validateAddressBody.DeviceType ?? null; set => _validateAddressBody.DeviceType = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the + /// time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025 + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer friendly name of the combination of version and capacity of the device. This field is necessary only at the time of ordering the newer generation device i.e. AzureDataBox120 and AzureDataBox525 as of Feb/2025", + SerializedName = @"model", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("DataBox", "DataBoxDisk", "DataBoxHeavy", "DataBoxCustomerDisk", "AzureDataBox120", "AzureDataBox525")] + public string Model { get => _validateAddressBody.Model ?? null; set => _validateAddressBody.Model = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Name of the City. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Name of the City.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the City.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressCity { get => _validateAddressBody.ShippingAddressCity ?? null; set => _validateAddressBody.ShippingAddressCity = value; } + + /// Name of the company. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Name of the company.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the company.", + SerializedName = @"companyName", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressCompanyName { get => _validateAddressBody.ShippingAddressCompanyName ?? null; set => _validateAddressBody.ShippingAddressCompanyName = value; } + + /// Name of the Country. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the Country.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the Country.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressCountry { get => _validateAddressBody.ShippingAddressCountry ?? null; set => _validateAddressBody.ShippingAddressCountry = value; } + + /// Postal code. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Postal code.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Postal code.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressPostalCode { get => _validateAddressBody.ShippingAddressPostalCode ?? null; set => _validateAddressBody.ShippingAddressPostalCode = value; } + + /// Flag to indicate if customer has chosen to skip default address validation + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Flag to indicate if customer has chosen to skip default address validation")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Flag to indicate if customer has chosen to skip default address validation", + SerializedName = @"skipAddressValidation", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter ShippingAddressSkipAddressValidation { get => _validateAddressBody.ShippingAddressSkipAddressValidation ?? default(global::System.Management.Automation.SwitchParameter); set => _validateAddressBody.ShippingAddressSkipAddressValidation = value; } + + /// Name of the State or Province. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Name of the State or Province.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the State or Province.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressStateOrProvince { get => _validateAddressBody.ShippingAddressStateOrProvince ?? null; set => _validateAddressBody.ShippingAddressStateOrProvince = value; } + + /// Street Address line 1. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Street Address line 1.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Street Address line 1.", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressStreetAddress1 { get => _validateAddressBody.ShippingAddressStreetAddress1 ?? null; set => _validateAddressBody.ShippingAddressStreetAddress1 = value; } + + /// Street Address line 2. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Street Address line 2.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Street Address line 2.", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressStreetAddress2 { get => _validateAddressBody.ShippingAddressStreetAddress2 ?? null; set => _validateAddressBody.ShippingAddressStreetAddress2 = value; } + + /// Street Address line 3. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Street Address line 3.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Street Address line 3.", + SerializedName = @"streetAddress3", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressStreetAddress3 { get => _validateAddressBody.ShippingAddressStreetAddress3 ?? null; set => _validateAddressBody.ShippingAddressStreetAddress3 = value; } + + /// Tax Identification Number + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Tax Identification Number")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tax Identification Number", + SerializedName = @"taxIdentificationNumber", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressTaxIdentificationNumber { get => _validateAddressBody.ShippingAddressTaxIdentificationNumber ?? null; set => _validateAddressBody.ShippingAddressTaxIdentificationNumber = value; } + + /// Type of address. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Type of address.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of address.", + SerializedName = @"addressType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("None", "Residential", "Commercial")] + public string ShippingAddressType { get => _validateAddressBody.ShippingAddressType ?? null; set => _validateAddressBody.ShippingAddressType = value; } + + /// Extended Zip Code. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Extended Zip Code.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Extended Zip Code.", + SerializedName = @"zipExtendedCode", + PossibleTypes = new [] { typeof(string) })] + public string ShippingAddressZipExtendedCode { get => _validateAddressBody.ShippingAddressZipExtendedCode ?? null; set => _validateAddressBody.ShippingAddressZipExtendedCode = value; } + + /// Indicates Shipment Logistics type that the customer preferred. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates Shipment Logistics type that the customer preferred.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates Shipment Logistics type that the customer preferred.", + SerializedName = @"preferredShipmentType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("CustomerManaged", "MicrosoftManaged")] + public string TransportPreferencePreferredShipmentType { get => _validateAddressBody.TransportPreferencePreferredShipmentType ?? null; set => _validateAddressBody.TransportPreferencePreferredShipmentType = value; } + + /// Identifies the type of validation request. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identifies the type of validation request.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Identifies the type of validation request.", + SerializedName = @"validationType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.PSArgumentCompleterAttribute("ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", "ValidateCreateOrderLimit", "ValidateSkuAvailability", "ValidateDataTransferDetails")] + public string ValidationType { get => _validateAddressBody.ValidationType ?? null; set => _validateAddressBody.ValidationType = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IAddressValidationOutput + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateAddress' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ServiceValidateAddressViaIdentity(InputObject.Id, _validateAddressBody, onOk, onDefault, this, Pipeline); + } + 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.Location) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Location"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ServiceValidateAddress(InputObject.SubscriptionId ?? null, InputObject.Location ?? null, _validateAddressBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceAddress_ValidateViaIdentityExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IAddressValidationOutput + /// 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.DataBox.Models.IAddressValidationOutput + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaJsonFilePath.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaJsonFilePath.cs new file mode 100644 index 00000000000..ff4aeffd590 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaJsonFilePath.cs @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide + /// alternate addresses if any. + /// + /// + /// [OpenAPI] ValidateAddress=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceAddress_ValidateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutput))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class TestAzDataBoxServiceAddress_ValidateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Validate operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Validate operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Validate 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; } } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IAddressValidationOutput + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateAddress' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceValidateAddressViaJsonString(SubscriptionId, Location, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceAddress_ValidateViaJsonFilePath() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IAddressValidationOutput + /// 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.DataBox.Models.IAddressValidationOutput + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaJsonString.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaJsonString.cs new file mode 100644 index 00000000000..fba82b0cf7d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceAddress_ValidateViaJsonString.cs @@ -0,0 +1,508 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide + /// alternate addresses if any. + /// + /// + /// [OpenAPI] ValidateAddress=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceAddress_ValidateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IAddressValidationOutput))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class TestAzDataBoxServiceAddress_ValidateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Validate operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Validate operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Validate operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IAddressValidationOutput + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateAddress' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceValidateAddressViaJsonString(SubscriptionId, Location, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceAddress_ValidateViaJsonString() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IAddressValidationOutput + /// 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.DataBox.Models.IAddressValidationOutput + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_Validate.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_Validate.cs new file mode 100644 index 00000000000..b20e60a6405 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_Validate.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// This method does all necessary pre-job creation validation under subscription. + /// + /// [OpenAPI] ValidateInputs=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceInput_Validate", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method does all necessary pre-job creation validation under subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs", ApiVersion = "2025-07-01")] + public partial class TestAzDataBoxServiceInput_Validate : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest _validationRequest; + + /// Minimum request requirement of any validation category. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Minimum request requirement of any validation category.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Minimum request requirement of any validation category.", + SerializedName = @"validationRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateJobValidations) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest ValidationRequest { get => this._validationRequest; set => this._validationRequest = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IValidationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateInputs' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceValidateInputs(SubscriptionId, Location, ValidationRequest, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceInput_Validate() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IValidationResponse + /// 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.DataBox.Models.IValidationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_Validate1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_Validate1.cs new file mode 100644 index 00000000000..07439c75e74 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_Validate1.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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// + /// [OpenAPI] ValidateInputsByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceInput_Validate1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method does all necessary pre-job creation validation under resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs", ApiVersion = "2025-07-01")] + public partial class TestAzDataBoxServiceInput_Validate1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest _validationRequest; + + /// Minimum request requirement of any validation category. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Minimum request requirement of any validation category.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Minimum request requirement of any validation category.", + SerializedName = @"validationRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateJobValidations) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest ValidationRequest { get => this._validationRequest; set => this._validationRequest = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IValidationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateInputsByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceValidateInputsByResourceGroup(SubscriptionId, ResourceGroupName, Location, ValidationRequest, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceInput_Validate1() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IValidationResponse + /// 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.DataBox.Models.IValidationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateExpanded.cs new file mode 100644 index 00000000000..07b0a0034b6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateExpanded.cs @@ -0,0 +1,508 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// This method does all necessary pre-job creation validation under subscription. + /// + /// [OpenAPI] ValidateInputs=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceInput_ValidateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method does all necessary pre-job creation validation under subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs", ApiVersion = "2025-07-01")] + public partial class TestAzDataBoxServiceInput_ValidateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// Minimum request requirement of any validation category. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest _validationRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationRequest(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// + /// List of request details contain validationType and its request as key and value respectively. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "List of request details contain validationType and its request as key and value respectively.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"List of request details contain validationType and its request as key and value respectively.", + SerializedName = @"individualRequestDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest) })] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest[] IndividualRequestDetail { get => _validationRequestBody.IndividualRequestDetail?.ToArray() ?? null /* fixedArrayOf */; set => _validationRequestBody.IndividualRequestDetail = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// 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 _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IValidationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateInputs' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceValidateInputs(SubscriptionId, Location, _validationRequestBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceInput_ValidateExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IValidationResponse + /// 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.DataBox.Models.IValidationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateExpanded1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateExpanded1.cs new file mode 100644 index 00000000000..54065a315f5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateExpanded1.cs @@ -0,0 +1,524 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// + /// [OpenAPI] ValidateInputsByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceInput_ValidateExpanded1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method does all necessary pre-job creation validation under resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs", ApiVersion = "2025-07-01")] + public partial class TestAzDataBoxServiceInput_ValidateExpanded1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// Minimum request requirement of any validation category. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest _validationRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationRequest(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// + /// List of request details contain validationType and its request as key and value respectively. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "List of request details contain validationType and its request as key and value respectively.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"List of request details contain validationType and its request as key and value respectively.", + SerializedName = @"individualRequestDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest) })] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest[] IndividualRequestDetail { get => _validationRequestBody.IndividualRequestDetail?.ToArray() ?? null /* fixedArrayOf */; set => _validationRequestBody.IndividualRequestDetail = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// 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 _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IValidationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateInputsByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceValidateInputsByResourceGroup(SubscriptionId, ResourceGroupName, Location, _validationRequestBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceInput_ValidateExpanded1() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IValidationResponse + /// 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.DataBox.Models.IValidationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentity.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentity.cs new file mode 100644 index 00000000000..a167d04f9b2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentity.cs @@ -0,0 +1,496 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// This method does all necessary pre-job creation validation under subscription. + /// + /// [OpenAPI] ValidateInputs=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceInput_ValidateViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method does all necessary pre-job creation validation under subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs", ApiVersion = "2025-07-01")] + public partial class TestAzDataBoxServiceInput_ValidateViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest _validationRequest; + + /// Minimum request requirement of any validation category. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Minimum request requirement of any validation category.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Minimum request requirement of any validation category.", + SerializedName = @"validationRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateJobValidations) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest ValidationRequest { get => this._validationRequest; set => this._validationRequest = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IValidationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateInputs' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ServiceValidateInputsViaIdentity(InputObject.Id, ValidationRequest, onOk, onDefault, this, Pipeline); + } + 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.Location) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Location"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ServiceValidateInputs(InputObject.SubscriptionId ?? null, InputObject.Location ?? null, ValidationRequest, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceInput_ValidateViaIdentity() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IValidationResponse + /// 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.DataBox.Models.IValidationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentity1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentity1.cs new file mode 100644 index 00000000000..8ddbbe51f3e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentity1.cs @@ -0,0 +1,502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// + /// [OpenAPI] ValidateInputsByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceInput_ValidateViaIdentity1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method does all necessary pre-job creation validation under resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs", ApiVersion = "2025-07-01")] + public partial class TestAzDataBoxServiceInput_ValidateViaIdentity1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest _validationRequest; + + /// Minimum request requirement of any validation category. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Minimum request requirement of any validation category.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Minimum request requirement of any validation category.", + SerializedName = @"validationRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateJobValidations) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest ValidationRequest { get => this._validationRequest; set => this._validationRequest = 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IValidationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateInputsByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ServiceValidateInputsByResourceGroupViaIdentity(InputObject.Id, ValidationRequest, onOk, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.Location) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Location"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ServiceValidateInputsByResourceGroup(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.Location ?? null, ValidationRequest, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceInput_ValidateViaIdentity1() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IValidationResponse + /// 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.DataBox.Models.IValidationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentityExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentityExpanded.cs new file mode 100644 index 00000000000..a5b94fe6998 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentityExpanded.cs @@ -0,0 +1,499 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// This method does all necessary pre-job creation validation under subscription. + /// + /// [OpenAPI] ValidateInputs=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceInput_ValidateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method does all necessary pre-job creation validation under subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs", ApiVersion = "2025-07-01")] + public partial class TestAzDataBoxServiceInput_ValidateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// Minimum request requirement of any validation category. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest _validationRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationRequest(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// + /// List of request details contain validationType and its request as key and value respectively. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "List of request details contain validationType and its request as key and value respectively.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"List of request details contain validationType and its request as key and value respectively.", + SerializedName = @"individualRequestDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest) })] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest[] IndividualRequestDetail { get => _validationRequestBody.IndividualRequestDetail?.ToArray() ?? null /* fixedArrayOf */; set => _validationRequestBody.IndividualRequestDetail = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IValidationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateInputs' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ServiceValidateInputsViaIdentity(InputObject.Id, _validationRequestBody, onOk, onDefault, this, Pipeline); + } + 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.Location) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Location"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ServiceValidateInputs(InputObject.SubscriptionId ?? null, InputObject.Location ?? null, _validationRequestBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceInput_ValidateViaIdentityExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IValidationResponse + /// 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.DataBox.Models.IValidationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentityExpanded1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentityExpanded1.cs new file mode 100644 index 00000000000..c81087c0765 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaIdentityExpanded1.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// + /// [OpenAPI] ValidateInputsByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceInput_ValidateViaIdentityExpanded1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method does all necessary pre-job creation validation under resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs", ApiVersion = "2025-07-01")] + public partial class TestAzDataBoxServiceInput_ValidateViaIdentityExpanded1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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; + + /// Minimum request requirement of any validation category. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationRequest _validationRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ValidationRequest(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// + /// List of request details contain validationType and its request as key and value respectively. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "List of request details contain validationType and its request as key and value respectively.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"List of request details contain validationType and its request as key and value respectively.", + SerializedName = @"individualRequestDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidateAddress),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ICreateOrderLimitForSubscriptionValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataTransferDetailsValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IPreferencesValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISkuAvailabilityValidationRequest),typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.ISubscriptionIsAllowedToCreateJobValidationRequest) })] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationInputRequest[] IndividualRequestDetail { get => _validationRequestBody.IndividualRequestDetail?.ToArray() ?? null /* fixedArrayOf */; set => _validationRequestBody.IndividualRequestDetail = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IValidationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateInputsByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ServiceValidateInputsByResourceGroupViaIdentity(InputObject.Id, _validationRequestBody, onOk, onDefault, this, Pipeline); + } + 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) ); + } + if (null == InputObject.Location) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.Location"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ServiceValidateInputsByResourceGroup(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.Location ?? null, _validationRequestBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceInput_ValidateViaIdentityExpanded1() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IValidationResponse + /// 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.DataBox.Models.IValidationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonFilePath.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonFilePath.cs new file mode 100644 index 00000000000..c07988fad9f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonFilePath.cs @@ -0,0 +1,507 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// This method does all necessary pre-job creation validation under subscription. + /// + /// [OpenAPI] ValidateInputs=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceInput_ValidateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method does all necessary pre-job creation validation under subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class TestAzDataBoxServiceInput_ValidateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Validate operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Validate operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Validate 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; } } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IValidationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateInputs' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceValidateInputsViaJsonString(SubscriptionId, Location, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceInput_ValidateViaJsonFilePath() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IValidationResponse + /// 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.DataBox.Models.IValidationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonFilePath1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonFilePath1.cs new file mode 100644 index 00000000000..a759f1248e2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonFilePath1.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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// + /// [OpenAPI] ValidateInputsByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceInput_ValidateViaJsonFilePath1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method does all necessary pre-job creation validation under resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class TestAzDataBoxServiceInput_ValidateViaJsonFilePath1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Validate operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Validate operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Validate 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; } } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IValidationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateInputsByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceValidateInputsByResourceGroupViaJsonString(SubscriptionId, ResourceGroupName, Location, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceInput_ValidateViaJsonFilePath1() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IValidationResponse + /// 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.DataBox.Models.IValidationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonString.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonString.cs new file mode 100644 index 00000000000..f5d6f401355 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonString.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// This method does all necessary pre-job creation validation under subscription. + /// + /// [OpenAPI] ValidateInputs=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceInput_ValidateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method does all necessary pre-job creation validation under subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class TestAzDataBoxServiceInput_ValidateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Validate operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Validate operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Validate operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IValidationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateInputs' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceValidateInputsViaJsonString(SubscriptionId, Location, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceInput_ValidateViaJsonString() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IValidationResponse + /// 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.DataBox.Models.IValidationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonString1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonString1.cs new file mode 100644 index 00000000000..9c962f83ce8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/TestAzDataBoxServiceInput_ValidateViaJsonString1.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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// + /// [OpenAPI] ValidateInputsByResourceGroup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzDataBoxServiceInput_ValidateViaJsonString1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IValidationResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"This method does all necessary pre-job creation validation under resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class TestAzDataBoxServiceInput_ValidateViaJsonString1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 Validate operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Validate operation")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Validate operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure region.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IValidationResponse + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ServiceValidateInputsByResourceGroup' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ServiceValidateInputsByResourceGroupViaJsonString(SubscriptionId, ResourceGroupName, Location, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,Location=Location}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzDataBoxServiceInput_ValidateViaJsonString1() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IValidationResponse + /// 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.DataBox.Models.IValidationResponse + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateExpanded.cs new file mode 100644 index 00000000000..7b8c226df22 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateExpanded.cs @@ -0,0 +1,635 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// update the properties of an existing job. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzDataBoxJob_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"update the properties of an existing job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", ApiVersion = "2025-07-01")] + public partial class UpdateAzDataBoxJob_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + + /// The JobResourceUpdateParameter. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter _jobResourceUpdateParameterBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceUpdateParameter(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Details of a job to be updated. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Details of a job to be updated.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Details of a job to be updated.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails) })] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails Detail { get => _jobResourceUpdateParameterBody.Detail ?? null /* object */; set => _jobResourceUpdateParameterBody.Detail = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Identity type + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Identity type")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Identity type", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + public string IdentityType { get => _jobResourceUpdateParameterBody.IdentityType ?? null; set => _jobResourceUpdateParameterBody.IdentityType = value; } + + /// Backing field for property. + private string _ifMatch; + + /// + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + SerializedName = @"If-Match", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Header)] + public string IfMatch { get => this._ifMatch; set => this._ifMatch = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across + /// resource groups). + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags Tag { get => _jobResourceUpdateParameterBody.Tag ?? null /* object */; set => _jobResourceUpdateParameterBody.Tag = value; } + + /// + /// The array of user assigned identities associated with the resource. The elements in array will be ARM resource ids in + /// the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.' + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The array of user assigned identities associated with the resource. The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.'")] + [global::System.Management.Automation.AllowEmptyCollection] + public string[] UserAssignedIdentity { get; set; } + + /// + /// 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IJobResource + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzDataBoxJob_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets.UpdateAzDataBoxJob_UpdateExpanded Clone() + { + var clone = new UpdateAzDataBoxJob_UpdateExpanded(); + 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._jobResourceUpdateParameterBody = this._jobResourceUpdateParameterBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + clone.IfMatch = this.IfMatch; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (this.UserAssignedIdentity?.Length > 0) + { + // calculate UserAssignedIdentity + _jobResourceUpdateParameterBody.IdentityUserAssignedIdentity.Clear(); + foreach( var id in this.UserAssignedIdentity ) + { + _jobResourceUpdateParameterBody.IdentityUserAssignedIdentity.Add(id, new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedIdentity()); + } + } + await this.Client.JobsUpdate(SubscriptionId, ResourceGroupName, Name, this.InvocationInformation.BoundParameters.ContainsKey("IfMatch") ? IfMatch : null, _jobResourceUpdateParameterBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,IfMatch=this.InvocationInformation.BoundParameters.ContainsKey("IfMatch") ? IfMatch : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzDataBoxJob_UpdateExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IJobResource + /// 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.DataBox.Models.IJobResource + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateViaIdentityExpanded.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateViaIdentityExpanded.cs new file mode 100644 index 00000000000..f3b186326c4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateViaIdentityExpanded.cs @@ -0,0 +1,618 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// update the properties of an existing job. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzDataBoxJob_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"update the properties of an existing job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", ApiVersion = "2025-07-01")] + public partial class UpdateAzDataBoxJob_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + + /// The JobResourceUpdateParameter. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameter _jobResourceUpdateParameterBody = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.JobResourceUpdateParameter(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Details of a job to be updated. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Details of a job to be updated.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Details of a job to be updated.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails) })] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IUpdateJobDetails Detail { get => _jobResourceUpdateParameterBody.Detail ?? null /* object */; set => _jobResourceUpdateParameterBody.Detail = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Identity type + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Identity type")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Identity type", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + public string IdentityType { get => _jobResourceUpdateParameterBody.IdentityType ?? null; set => _jobResourceUpdateParameterBody.IdentityType = value; } + + /// Backing field for property. + private string _ifMatch; + + /// + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + SerializedName = @"If-Match", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Header)] + public string IfMatch { get => this._ifMatch; set => this._ifMatch = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IDataBoxIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across + /// resource groups). + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups).", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResourceUpdateParameterTags Tag { get => _jobResourceUpdateParameterBody.Tag ?? null /* object */; set => _jobResourceUpdateParameterBody.Tag = value; } + + /// + /// The array of user assigned identities associated with the resource. The elements in array will be ARM resource ids in + /// the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.' + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The array of user assigned identities associated with the resource. The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.'")] + [global::System.Management.Automation.AllowEmptyCollection] + public string[] UserAssignedIdentity { get; set; } + + /// + /// 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.DataBox.Models.IApiError + /// 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.DataBox.Models.IJobResource + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzDataBoxJob_UpdateViaIdentityExpanded + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets.UpdateAzDataBoxJob_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzDataBoxJob_UpdateViaIdentityExpanded(); + 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._jobResourceUpdateParameterBody = this._jobResourceUpdateParameterBody; + clone.IfMatch = this.IfMatch; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + if (this.UserAssignedIdentity?.Length > 0) + { + // calculate UserAssignedIdentity + _jobResourceUpdateParameterBody.IdentityUserAssignedIdentity.Clear(); + foreach( var id in this.UserAssignedIdentity ) + { + _jobResourceUpdateParameterBody.IdentityUserAssignedIdentity.Add(id, new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedIdentity()); + } + } + await this.Client.JobsUpdateViaIdentity(InputObject.Id, this.InvocationInformation.BoundParameters.ContainsKey("IfMatch") ? IfMatch : null, _jobResourceUpdateParameterBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.DataBox.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) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (this.UserAssignedIdentity?.Length > 0) + { + // calculate UserAssignedIdentity + _jobResourceUpdateParameterBody.IdentityUserAssignedIdentity.Clear(); + foreach( var id in this.UserAssignedIdentity ) + { + _jobResourceUpdateParameterBody.IdentityUserAssignedIdentity.Add(id, new Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.UserAssignedIdentity()); + } + } + await this.Client.JobsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.JobName ?? null, this.InvocationInformation.BoundParameters.ContainsKey("IfMatch") ? IfMatch : null, _jobResourceUpdateParameterBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SerializationMode.IncludeUpdate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { IfMatch=this.InvocationInformation.BoundParameters.ContainsKey("IfMatch") ? IfMatch : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzDataBoxJob_UpdateViaIdentityExpanded() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IJobResource + /// 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.DataBox.Models.IJobResource + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateViaJsonFilePath.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateViaJsonFilePath.cs new file mode 100644 index 00000000000..408f0d11bad --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateViaJsonFilePath.cs @@ -0,0 +1,594 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// update the properties of an existing job. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzDataBoxJob_UpdateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"update the properties of an existing job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class UpdateAzDataBoxJob_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + + public global::System.String _jsonString; + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _ifMatch; + + /// + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + SerializedName = @"If-Match", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Header)] + public string IfMatch { get => this._ifMatch; set => this._ifMatch = value; } + + /// 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.DataBox.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.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IJobResource + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzDataBoxJob_UpdateViaJsonFilePath + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets.UpdateAzDataBoxJob_UpdateViaJsonFilePath Clone() + { + var clone = new UpdateAzDataBoxJob_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.IfMatch = this.IfMatch; + clone.JsonFilePath = this.JsonFilePath; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, this.InvocationInformation.BoundParameters.ContainsKey("IfMatch") ? IfMatch : null, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,IfMatch=this.InvocationInformation.BoundParameters.ContainsKey("IfMatch") ? IfMatch : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzDataBoxJob_UpdateViaJsonFilePath() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IJobResource + /// 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.DataBox.Models.IJobResource + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateViaJsonString.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateViaJsonString.cs new file mode 100644 index 00000000000..428b5d6b054 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/cmdlets/UpdateAzDataBoxJob_UpdateViaJsonString.cs @@ -0,0 +1,592 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Cmdlets; + using System; + + /// update the properties of an existing job. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzDataBoxJob_UpdateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models.IJobResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Description(@"update the properties of an existing job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", ApiVersion = "2025-07-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.NotSuggestDefaultParameterSet] + public partial class UpdateAzDataBoxJob_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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(); + + /// 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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.DataBoxManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _ifMatch; + + /// + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value.", + SerializedName = @"If-Match", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.ParameterCategory.Header)] + public string IfMatch { get => this._ifMatch; set => this._ifMatch = value; } + + /// 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.DataBox.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.DataBox.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length + /// and use any alphanumeric and underscore only + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.Category(global::Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.Models.IJobResource + /// 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.DataBox.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzDataBoxJob_UpdateViaJsonString + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Cmdlets.UpdateAzDataBoxJob_UpdateViaJsonString Clone() + { + var clone = new UpdateAzDataBoxJob_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.IfMatch = this.IfMatch; + clone.JsonString = this.JsonString; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.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.DataBox.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.DataBox.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.DataBox.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, this.InvocationInformation.BoundParameters.ContainsKey("IfMatch") ? IfMatch : null, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.DataBox.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,IfMatch=this.InvocationInformation.BoundParameters.ContainsKey("IfMatch") ? IfMatch : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzDataBoxJob_UpdateViaJsonString() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.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.DataBox.Models.IApiError + /// 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.DataBox.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.DataBox.Models.IJobResource + /// 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.DataBox.Models.IJobResource + var result = (await response); + WriteObject(result, false); + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/AsyncCommandRuntime.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/AsyncCommandRuntime.cs new file mode 100644 index 00000000000..fb4c84b4038 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/AsyncCommandRuntime.cs @@ -0,0 +1,832 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + using System.Linq; + + internal interface IAsyncCommandRuntimeExtensions + { + Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep func); + System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs); + + T ExecuteSync(System.Func step); + } + + public class AsyncCommandRuntime : System.Management.Automation.ICommandRuntime2, IAsyncCommandRuntimeExtensions, System.IDisposable + { + private ICommandRuntime2 originalCommandRuntime; + private System.Threading.Thread originalThread; + public bool AllowInteractive { get; set; } = false; + + public CancellationToken cancellationToken; + SemaphoreSlim semaphore = new SemaphoreSlim(1, 1); + ManualResetEventSlim readyToRun = new ManualResetEventSlim(false); + ManualResetEventSlim completed = new ManualResetEventSlim(false); + + System.Action runOnMainThread; + + private System.Management.Automation.PSCmdlet cmdlet; + + internal AsyncCommandRuntime(System.Management.Automation.PSCmdlet cmdlet, CancellationToken cancellationToken) + { + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + this.cancellationToken = cancellationToken; + this.cmdlet = cmdlet; + if (cmdlet.PagingParameters != null) + { + WriteDebug("Client side pagination is enabled for this cmdlet"); + } + cmdlet.CommandRuntime = this; + } + + public PSHost Host => this.originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => this.originalCommandRuntime.CurrentPSTransaction; + + private void CheckForInteractive() + { + // This is an interactive call -- if we are not on the original thread, this will only work if this was done at ACR creation time; + if (!AllowInteractive) + { + throw new System.Exception("AsyncCommandRuntime is not configured for interactive calls"); + } + } + private void WaitOurTurn() + { + // wait for our turn to play + semaphore?.Wait(cancellationToken); + + // ensure that completed is not set + completed.Reset(); + } + + private void WaitForCompletion() + { + // wait for the result (or cancellation!) + WaitHandle.WaitAny(new[] { cancellationToken.WaitHandle, completed?.WaitHandle }); + + // let go of the semaphore + semaphore?.Release(); + + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target, string action) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target, action); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target, action); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + ShouldProcessReason reason = ShouldProcessReason.None; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out reason); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + shouldProcessReason = reason; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.ThrowTerminatingError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.ThrowTerminatingError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool TransactionAvailable() + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.TransactionAvailable(); + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.TransactionAvailable(); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteCommandDetail(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteCommandDetail(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteCommandDetail(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteDebug(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteDebug(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteDebug(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteInformation(informationRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteInformation(informationRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(sourceId, progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(sourceId, progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteVerbose(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteVerbose(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteVerbose(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteWarning(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteWarning(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteWarning(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Wait(System.Threading.Tasks.Task ProcessRecordAsyncTask, System.Threading.CancellationToken cancellationToken) + { + do + { + WaitHandle.WaitAny(new[] { readyToRun.WaitHandle, ((System.IAsyncResult)ProcessRecordAsyncTask).AsyncWaitHandle }); + if (readyToRun.IsSet) + { + // reset the request for the next time + readyToRun.Reset(); + + // run the delegate on this thread + runOnMainThread(); + + // tell the originator everything is complete + completed.Set(); + } + } + while (!ProcessRecordAsyncTask.IsCompleted); + if (ProcessRecordAsyncTask.IsFaulted) + { + // don't unwrap a Aggregate Exception -- we'll lose the stack trace of the actual exception. + // if( ProcessRecordAsyncTask.Exception is System.AggregateException aggregate ) { + // throw aggregate.InnerException; + // } + throw ProcessRecordAsyncTask.Exception; + } + } + public Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep func) => func.Target.GetType().Name != "Closure" ? func : (p1, p2, p3) => ExecuteSync>(() => func(p1, p2, p3)); + public System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs) => funcs?.Select(Wrap); + + public T ExecuteSync(System.Func step) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return step(); + } + + T result = default(T); + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + // set the function to run + runOnMainThread = () => { result = step(); }; + // tell the main thread to go ahead + readyToRun.Set(); + // wait for the result (or cancellation!) + WaitForCompletion(); + // return + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Dispose() + { + if (cmdlet != null) + { + cmdlet.CommandRuntime = this.originalCommandRuntime; + cmdlet = null; + } + + semaphore?.Dispose(); + semaphore = null; + readyToRun?.Dispose(); + readyToRun = null; + completed?.Dispose(); + completed = null; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/AsyncJob.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/AsyncJob.cs new file mode 100644 index 00000000000..868a34ba067 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/AsyncJob.cs @@ -0,0 +1,270 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + + using System.Threading.Tasks; + + public class LongRunningJobCancelledException : System.Exception + { + public LongRunningJobCancelledException(string message) : base(message) + { + + } + } + + public class AsyncJob : Job, System.Management.Automation.ICommandRuntime2 + { + const int MaxRecords = 1000; + + private string _statusMessage = string.Empty; + + public override string StatusMessage => _statusMessage; + + public override bool HasMoreData => Output.Count > 0 || Progress.Count > 0 || Error.Count > 0 || Warning.Count > 0 || Verbose.Count > 0 || Debug.Count > 0; + + public override string Location => "localhost"; + + public PSHost Host => originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => originalCommandRuntime.CurrentPSTransaction; + + public override void StopJob() + { + Cancel(); + } + + private readonly PSCmdlet cmdlet; + private readonly ICommandRuntime2 originalCommandRuntime; + private readonly System.Threading.Thread originalThread; + + private void CheckForInteractive() + { + // This is an interactive call -- We should never allow interactivity in AsnycJob cmdlets. + throw new System.Exception("Cmdlets in AsyncJob; interactive calls are not permitted."); + } + private bool IsJobDone => CancellationToken.IsCancellationRequested || this.JobStateInfo.State == JobState.Failed || this.JobStateInfo.State == JobState.Stopped || this.JobStateInfo.State == JobState.Stopping || this.JobStateInfo.State == JobState.Completed; + + private readonly System.Action Cancel; + private readonly CancellationToken CancellationToken; + + internal AsyncJob(PSCmdlet cmdlet, string line, string name, CancellationToken cancellationToken, System.Action cancelMethod) : base(line, name) + { + SetJobState(JobState.NotStarted); + // know how to cancel/check for cancelation + this.CancellationToken = cancellationToken; + this.Cancel = cancelMethod; + + // we might need these. + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + + // the instance of the cmdlet we're going to run + this.cmdlet = cmdlet; + + // set the command runtime to the AsyncJob + cmdlet.CommandRuntime = this; + } + + /// + /// Monitors the task (which should be ProcessRecordAsync) to control + /// the lifetime of the job itself + /// + /// + public void Monitor(Task task) + { + SetJobState(JobState.Running); + task.ContinueWith(antecedent => + { + if (antecedent.IsCanceled) + { + // if the task was canceled, we're just going to call it completed. + SetJobState(JobState.Completed); + } + else if (antecedent.IsFaulted) + { + foreach (var innerException in antecedent.Exception.Flatten().InnerExceptions) + { + WriteError(new System.Management.Automation.ErrorRecord(innerException, string.Empty, System.Management.Automation.ErrorCategory.NotSpecified, null)); + } + + // a fault indicates an actual failure + SetJobState(JobState.Failed); + } + else + { + // otherwiser it's a completed state. + SetJobState(JobState.Completed); + } + }, CancellationToken); + } + + private void CheckForCancellation() + { + if (IsJobDone) + { + throw new LongRunningJobCancelledException("Long running job is canceled or stopping, continuation of the cmdlet is not permitted."); + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + CheckForCancellation(); + + this.Information.Add(informationRecord); + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public void WriteDebug(string text) + { + _statusMessage = text; + CheckForCancellation(); + + if (Debug.IsOpen && Debug.Count < MaxRecords) + { + Debug.Add(new DebugRecord(text)); + } + } + + public void WriteError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + + public void WriteObject(object sendToPipeline) + { + CheckForCancellation(); + + if (Output.IsOpen) + { + Output.Add(new PSObject(sendToPipeline)); + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + CheckForCancellation(); + + if (enumerateCollection && sendToPipeline is System.Collections.IEnumerable enumerable) + { + foreach (var item in enumerable) + { + WriteObject(item); + } + } + else + { + WriteObject(sendToPipeline); + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteVerbose(string text) + { + CheckForCancellation(); + + if (Verbose.IsOpen && Verbose.Count < MaxRecords) + { + Verbose.Add(new VerboseRecord(text)); + } + } + + public void WriteWarning(string text) + { + CheckForCancellation(); + + if (Warning.IsOpen && Warning.Count < MaxRecords) + { + Warning.Add(new WarningRecord(text)); + } + } + + public void WriteCommandDetail(string text) + { + WriteVerbose(text); + } + + public bool ShouldProcess(string target) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string target, string action) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + CheckForInteractive(); + shouldProcessReason = ShouldProcessReason.None; + return false; + } + + public bool ShouldContinue(string query, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public bool TransactionAvailable() + { + // interactivity required? + return false; + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/AsyncOperationResponse.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/AsyncOperationResponse.cs new file mode 100644 index 00000000000..94357b592bf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/AsyncOperationResponse.cs @@ -0,0 +1,176 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.PowerShell +{ + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + [System.ComponentModel.TypeConverter(typeof(AsyncOperationResponseTypeConverter))] + public class AsyncOperationResponse + { + private string _target; + public string Target { get => _target; set => _target = value; } + public AsyncOperationResponse() + { + } + internal AsyncOperationResponse(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json) + { + // pull target + { Target = If(json?.PropertyT("target"), out var _v) ? (string)_v : (string)Target; } + } + public string ToJsonString() + { + return $"{{ \"target\" : \"{this.Target}\" }}"; + } + + public static AsyncOperationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject json ? new AsyncOperationResponse(json) : null; + } + + + /// + /// 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 AsyncOperationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(jsonText)); + + } + + public partial class AsyncOperationResponseTypeConverter : 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) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to a type + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted 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) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static object ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(AsyncOperationResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AsyncOperationResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()); ; + } + catch + { + // Unable to use JSON pattern + } + + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as System.Management.Automation.PSObject).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as global::System.Collections.IDictionary).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + return null; + } + + /// 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Attributes/ExternalDocsAttribute.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Attributes/ExternalDocsAttribute.cs new file mode 100644 index 00000000000..75fffe6b0a1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/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.DataBox +{ + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs new file mode 100644 index 00000000000..0ebea6e4d6a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/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.DataBox +{ + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs new file mode 100644 index 00000000000..aef0ecb1ad4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs @@ -0,0 +1,113 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "CmdletSurface")] + [DoNotExport] + public class ExportCmdletSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CmdletFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool IncludeGeneralParameters { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetScriptCmdlets(this, CmdletFolder) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + foreach (var profileGroup in profileGroups) + { + var variantGroups = profileGroup.Variants + .GroupBy(v => new { v.CmdletName }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), String.Empty, profileGroup.ProfileName)); + var sb = UseExpandedFormat ? ExpandedFormat(variantGroups) : CondensedFormat(variantGroups); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, $"CmdletSurface-{profileGroup.ProfileName}.md"), sb.ToString()); + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private StringBuilder ExpandedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + foreach (var variantGroup in variantGroups.OrderBy(vg => vg.CmdletName)) + { + sb.Append($"### {variantGroup.CmdletName}{Environment.NewLine}"); + var parameterGroups = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private StringBuilder CondensedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + var condensedGroups = variantGroups + .GroupBy(vg => vg.CmdletNoun) + .Select(vgg => ( + CmdletNoun: vgg.Key, + CmdletVerbs: vgg.Select(vg => vg.CmdletVerb).OrderBy(cv => cv).ToArray(), + ParameterGroups: vgg.SelectMany(vg => vg.ParameterGroups).DistinctBy(p => p.ParameterName).ToArray(), + OutputTypes: vgg.SelectMany(vg => vg.OutputTypes).Select(ot => ot.Type).DistinctBy(t => t.Name).Select(t => t.ToSyntaxTypeName()).ToArray())) + .OrderBy(vg => vg.CmdletNoun); + foreach (var condensedGroup in condensedGroups) + { + sb.Append($"### {condensedGroup.CmdletNoun} [{String.Join(", ", condensedGroup.CmdletVerbs)}] `{String.Join(", ", condensedGroup.OutputTypes)}`{Environment.NewLine}"); + var parameterGroups = condensedGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs new file mode 100644 index 00000000000..3dca12b676c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * 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.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ExampleStub")] + [DoNotExport] + public class ExportExampleStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + protected override void ProcessRecord() + { + 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 exampleText = String.Join(String.Empty, DefaultExampleHelpInfos.Select(ehi => ehi.ToHelpExampleOutput())); + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var cmdletFilePaths = GetScriptCmdlets(exportDirectory).Select(fi => Path.Combine(outputFolder, $"{fi.Name}.md")).ToArray(); + var currentExamplesFilePaths = Directory.GetFiles(outputFolder).ToArray(); + // Remove examples of non-existing cmdlets + var removedCmdletFilePaths = currentExamplesFilePaths.Except(cmdletFilePaths); + foreach (var removedCmdletFilePath in removedCmdletFilePaths) + { + File.Delete(removedCmdletFilePath); + } + + // Only create example stubs if they don't exist + foreach (var cmdletFilePath in cmdletFilePaths.Except(currentExamplesFilePaths)) + { + File.WriteAllText(cmdletFilePath, exampleText); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs new file mode 100644 index 00000000000..5b3669da35c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs @@ -0,0 +1,103 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "FormatPs1xml")] + [DoNotExport] + public class ExportFormatPs1xml : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string FilePath { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models"; + 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 + { + var viewModels = GetFilteredViewParameters().Select(CreateViewModel).ToList(); + var ps1xml = new Configuration + { + ViewDefinitions = new ViewDefinitions + { + Views = viewModels + } + }; + File.WriteAllText(FilePath, ps1xml.ToXmlString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static IEnumerable GetFilteredViewParameters() + { + //https://stackoverflow.com/a/79738/294804 + //https://stackoverflow.com/a/949285/294804 + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass + && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace)) + && !t.GetCustomAttributes().Any()); + return types.Select(t => new ViewParameters(t, t.GetProperties() + .Select(p => new PropertyFormat(p)) + .Where(pf => !pf.Property.GetCustomAttributes().Any() + && (!PropertiesExcludedForTableview.Split(',').Contains(pf.Property.Name)) + && (pf.FormatTable != null || (pf.Origin != PropertyOrigin.Inlined && pf.Property.PropertyType.IsPsSimple()))) + .OrderByDescending(pf => pf.Index.HasValue) + .ThenBy(pf => pf.Index) + .ThenByDescending(pf => pf.Origin.HasValue) + .ThenBy(pf => pf.Origin))).Where(vp => vp.Properties.Any()); + } + + private static View CreateViewModel(ViewParameters viewParameters) + { + var entries = viewParameters.Properties.Select(pf => + (TableColumnHeader: new TableColumnHeader { Label = pf.Label, Width = pf.Width }, + TableColumnItem: new TableColumnItem { PropertyName = pf.Property.Name })).ToArray(); + + return new View + { + Name = viewParameters.Type.FullName, + ViewSelectedBy = new ViewSelectedBy + { + TypeName = string.Concat(viewParameters.Type.FullName, SelectedBySuffix) + }, + TableControl = new TableControl + { + TableHeaders = new TableHeaders + { + TableColumnHeaders = entries.Select(e => e.TableColumnHeader).ToList() + }, + TableRowEntries = new TableRowEntries + { + TableRowEntry = new TableRowEntry + { + TableColumnItems = new TableColumnItems + { + TableItems = entries.Select(e => e.TableColumnItem).ToList() + } + } + } + } + }; + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs new file mode 100644 index 00000000000..8fdcecfb2ca --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs @@ -0,0 +1,56 @@ +/*--------------------------------------------------------------------------------------------- + * 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.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.MarkdownRenderer; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "HelpMarkdown")] + [DoNotExport] + public class ExportHelpMarkdown : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSModuleInfo ModuleInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] FunctionInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] HelpInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + [Parameter()] + public SwitchParameter AddComplexInterfaceInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var helpInfos = HelpInfo.Select(hi => hi.ToPsHelpInfo()); + var variantGroups = FunctionInfo.Select(fi => fi.BaseObject).Cast() + .Join(helpInfos, fi => fi.Name, phi => phi.CmdletName, (fi, phi) => fi.ToVariants(phi)) + .Select(va => new VariantGroup(ModuleInfo.Name, va.First().CmdletName, va, String.Empty)); + WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder, AddComplexInterfaceInfo.IsPresent); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs new file mode 100644 index 00000000000..81c10a3c98e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ModelSurface")] + [DoNotExport] + public class ExportModelSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.DataBox.Models"; + private const string SupportNamespace = @"${$project.supportNamespace.fullName}"; + + protected override void ProcessRecord() + { + try + { + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace))); + var typeInfos = types.Select(t => new ModelTypeInfo + { + Type = t, + TypeName = t.Name, + Properties = t.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => !p.GetIndexParameters().Any()).OrderBy(p => p.Name).ToArray(), + NamespaceGroup = t.Namespace.Split('.').LastOrDefault().EmptyIfNull() + }).Where(mti => mti.Properties.Any()); + var sb = UseExpandedFormat ? ExpandedFormat(typeInfos) : CondensedFormat(typeInfos); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, "ModelSurface.md"), sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static StringBuilder ExpandedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + foreach (var typeInfo in typeInfos.OrderBy(mti => mti.TypeName).ThenBy(mti => mti.NamespaceGroup)) + { + sb.Append($"### {typeInfo.TypeName} [{typeInfo.NamespaceGroup}]{Environment.NewLine}"); + foreach (var property in typeInfo.Properties) + { + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private static StringBuilder CondensedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + var typeGroups = typeInfos + .GroupBy(mti => mti.TypeName) + .Select(tig => ( + Types: tig.Select(mti => mti.Type).ToArray(), + TypeName: tig.Key, + Properties: tig.SelectMany(mti => mti.Properties).DistinctBy(p => p.Name).OrderBy(p => p.Name).ToArray(), + NamespaceGroups: tig.Select(mti => mti.NamespaceGroup).OrderBy(ng => ng).ToArray() + )) + .OrderBy(tg => tg.TypeName); + foreach (var typeGroup in typeGroups) + { + var aType = typeGroup.Types.Select(GetAssociativeType).FirstOrDefault(t => t != null); + var aText = aType != null ? $@" \<{aType.ToSyntaxTypeName()}\>" : String.Empty; + sb.Append($"### {typeGroup.TypeName}{aText} [{String.Join(", ", typeGroup.NamespaceGroups)}]{Environment.NewLine}"); + foreach (var property in typeGroup.Properties) + { + var propertyAType = GetAssociativeType(property.PropertyType); + var propertyAText = propertyAType != null ? $" <{propertyAType.ToSyntaxTypeName()}>" : String.Empty; + var enumNames = GetEnumFieldNames(property.PropertyType.Unwrap()); + var enumNamesText = enumNames.Any() ? $" **{{{String.Join(", ", enumNames)}}}**" : String.Empty; + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}{propertyAText}`{enumNamesText}{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + //https://stackoverflow.com/a/4963190/294804 + private static Type GetAssociativeType(Type type) => + type.GetInterfaces().FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>))?.GetGenericArguments().First(); + + private static string[] GetEnumFieldNames(Type type) => + type.IsValueType && !type.IsPrimitive && type != typeof(decimal) && type != typeof(DateTime) + ? type.GetFields(BindingFlags.Public | BindingFlags.Static).Where(f => f.FieldType == type).Select(p => p.Name).ToArray() + : new string[] { }; + + private class ModelTypeInfo + { + public Type Type { get; set; } + public string TypeName { get; set; } + public PropertyInfo[] Properties { get; set; } + public string NamespaceGroup { get; set; } + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs new file mode 100644 index 00000000000..929a6f35538 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -0,0 +1,180 @@ +/*--------------------------------------------------------------------------------------------- + * 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.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsHelpers; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.MarkdownRenderer; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsProxyTypeExtensions; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ProxyCmdlet", DefaultParameterSetName = "Docs")] + [DoNotExport] + public class ExportProxyCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string[] ModulePath { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string InternalFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [AllowEmptyString] + public string ModuleDescription { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + public Guid ModuleGuid { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "NoDocs")] + public SwitchParameter ExcludeDocs { get; set; } + + [Parameter(ParameterSetName = "Docs")] + public SwitchParameter AddComplexInterfaceInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetModuleCmdletsAndHelpInfo(this, ModulePath).SelectMany(ci => ci.ToVariants()).Where(v => !v.IsDoNotExport).ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + 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))) + .ToArray(); + var license = new StringBuilder(); + license.Append(@" +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the ""License""); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an ""AS IS"" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +"); + HashSet LicenseSet = new HashSet(); + foreach (var variantGroup in variantGroups) + { + var parameterGroups = variantGroup.ParameterGroups.ToList(); + var isValidProfile = !String.IsNullOrEmpty(variantGroup.ProfileName) && variantGroup.ProfileName != NoProfiles; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, variantGroup.ProfileName) : ExamplesFolder; + var markdownInfo = new MarkdownHelpInfo(variantGroup, examplesFolder); + List examples = new List(); + foreach (var it in markdownInfo.Examples) + { + examples.Add(it); + } + variantGroup.HelpInfo.Examples = examples.ToArray(); + var sb = new StringBuilder(); + sb.Append($"{Environment.NewLine}"); + sb.Append(variantGroup.ToHelpCommentOutput()); + sb.Append($"function {variantGroup.CmdletName} {{{Environment.NewLine}"); + sb.Append(variantGroup.Aliases.ToAliasOutput()); + sb.Append(variantGroup.OutputTypes.ToOutputTypeOutput()); + sb.Append(variantGroup.ToCmdletBindingOutput()); + sb.Append(variantGroup.ProfileName.ToProfileOutput()); + + 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; + parameters = parameters.Where(p => !p.IsHidden()); + if (!parameters.Any()) + { + continue; + } + foreach (var parameter in parameters) + { + sb.Append(parameter.ToParameterOutput(variantGroup.HasMultipleVariants, parameterGroup.HasAllVariants)); + } + sb.Append(parameterGroup.Aliases.ToAliasOutput(true)); + sb.Append(parameterGroup.HasValidateNotNull.ToValidateNotNullOutput()); + sb.Append(parameterGroup.HasAllowEmptyArray.ToAllowEmptyArray()); + sb.Append(parameterGroup.CompleterInfo.ToArgumentCompleterOutput()); + sb.Append(parameterGroup.OrderCategory.ToParameterCategoryOutput()); + sb.Append(parameterGroup.InfoAttribute.ToInfoOutput(parameterGroup.ParameterType)); + sb.Append(parameterGroup.ToDefaultInfoOutput()); + sb.Append(parameterGroup.ParameterType.ToParameterTypeOutput()); + sb.Append(parameterGroup.Description.ToParameterDescriptionOutput()); + sb.Append(parameterGroup.ParameterName.ToParameterNameOutput(parameterGroups.IndexOf(parameterGroup) == parameterGroups.Count - 1)); + } + sb.Append($"){Environment.NewLine}{Environment.NewLine}"); + + sb.Append(variantGroup.ToBeginOutput()); + sb.Append(variantGroup.ToProcessOutput()); + sb.Append(variantGroup.ToEndOutput()); + + sb.Append($"}}{Environment.NewLine}"); + + Directory.CreateDirectory(variantGroup.OutputFolder); + File.WriteAllText(variantGroup.FilePath, license.ToString()); + File.AppendAllText(variantGroup.FilePath, sb.ToString()); + if (!LicenseSet.Contains(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"))) + { + // only add license in the header + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), license.ToString()); + LicenseSet.Add(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1")); + } + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), sb.ToString()); + } + + if (!ExcludeDocs) + { + var moduleInfo = new PsModuleHelpInfo(ModuleName, ModuleGuid, ModuleDescription); + foreach (var variantGroupsByProfile in variantGroups.GroupBy(vg => vg.ProfileName)) + { + var profileName = variantGroupsByProfile.Key; + var isValidProfile = !String.IsNullOrEmpty(profileName) && profileName != NoProfiles; + var docsFolder = isValidProfile ? Path.Combine(DocsFolder, profileName) : DocsFolder; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, profileName) : ExamplesFolder; + WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder, AddComplexInterfaceInfo.IsPresent); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs new file mode 100644 index 00000000000..0aff6d1b381 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs @@ -0,0 +1,193 @@ +/*--------------------------------------------------------------------------------------------- + * 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.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "Psd1")] + [DoNotExport] + public class ExportPsd1 : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CustomFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + [Parameter(Mandatory = true)] + public Guid ModuleGuid { get; set; } + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + private const string CustomFolderRelative = "./custom"; + private const string Indent = Psd1Indent; + private const string Undefined = "undefined"; + private bool IsUndefined(string value) => string.Equals(Undefined, value, StringComparison.OrdinalIgnoreCase); + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + if (!Directory.Exists(CustomFolder)) + { + throw new ArgumentException($"Custom folder '{CustomFolder}' does not exist"); + } + + string version = Convert.ToString(@"0.1.0"); + // Validate the module version should be semantic version + // Following regex is official from https://semver.org/ + Regex rx = new Regex(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", RegexOptions.Compiled); + if (rx.Matches(version).Count != 1) + { + throw new ArgumentException("Module-version is not a valid Semantic Version"); + } + + string previewVersion = null; + if (version.Contains('-')) + { + string[] versions = version.Split("-".ToCharArray(), 2); + version = versions[0]; + previewVersion = versions[1]; + } + + var sb = new StringBuilder(); + sb.AppendLine("@{"); + sb.AppendLine($@"{GuidStart} = '{ModuleGuid}'"); + sb.AppendLine($@"{Indent}RootModule = '{"./Az.DataBox.psm1"}'"); + sb.AppendLine($@"{Indent}ModuleVersion = '{version}'"); + sb.AppendLine($@"{Indent}CompatiblePSEditions = 'Core', 'Desktop'"); + sb.AppendLine($@"{Indent}Author = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}CompanyName = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}Copyright = '{"Microsoft Corporation. All rights reserved."}'"); + sb.AppendLine($@"{Indent}Description = '{"Microsoft Azure PowerShell: DataBox cmdlets"}'"); + sb.AppendLine($@"{Indent}PowerShellVersion = '5.1'"); + sb.AppendLine($@"{Indent}DotNetFrameworkVersion = '4.7.2'"); + + // RequiredModules + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}RequiredModules = @({"undefined"})"); + } + + // RequiredAssemblies + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}RequiredAssemblies = @({"undefined"})"); + } + else + { + sb.AppendLine($@"{Indent}RequiredAssemblies = '{"./bin/Az.DataBox.private.dll"}'"); + } + + // NestedModules + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}NestedModules = @({"undefined"})"); + } + + // FormatsToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}FormatsToProcess = @({"undefined"})"); + } + else + { + var customFormatPs1xmlFiles = Directory.GetFiles(CustomFolder) + .Where(f => f.EndsWith(".format.ps1xml")) + .Select(f => $"{CustomFolderRelative}/{Path.GetFileName(f)}"); + var formatList = customFormatPs1xmlFiles.Prepend("./Az.DataBox.format.ps1xml").ToPsList(); + sb.AppendLine($@"{Indent}FormatsToProcess = {formatList}"); + } + + // TypesToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}TypesToProcess = @({"undefined"})"); + } + + // ScriptsToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}ScriptsToProcess = @({"undefined"})"); + } + + var functionInfos = GetScriptCmdlets(ExportsFolder).ToArray(); + // FunctionsToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}FunctionsToExport = @({"undefined"})"); + } + else + { + var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().ToPsList(); + sb.AppendLine($@"{Indent}FunctionsToExport = {cmdletsList}"); + } + + // AliasesToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}AliasesToExport = @({"undefined"})"); + } + else + { + var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().ToPsList(); + if (!String.IsNullOrEmpty(aliasesList)) { + sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + } + } + + // CmdletsToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}CmdletsToExport = @({"undefined"})"); + } + + sb.AppendLine($@"{Indent}PrivateData = @{{"); + sb.AppendLine($@"{Indent}{Indent}PSData = @{{"); + + if (previewVersion != null) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = '{previewVersion}'"); + } + sb.AppendLine($@"{Indent}{Indent}{Indent}Tags = {"Azure ResourceManager ARM PSModule DataBox".Split(' ').ToPsList().NullIfEmpty() ?? "''"}"); + sb.AppendLine($@"{Indent}{Indent}{Indent}LicenseUri = '{"https://aka.ms/azps-license"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ProjectUri = '{"https://github.com/Azure/azure-powershell"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ReleaseNotes = ''"); + var profilesList = ""; + if (IsAzure && !String.IsNullOrEmpty(profilesList)) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Profiles = {profilesList}"); + } + + sb.AppendLine($@"{Indent}{Indent}}}"); + sb.AppendLine($@"{Indent}}}"); + sb.AppendLine(@"}"); + + File.WriteAllText(Psd1Path, sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs new file mode 100644 index 00000000000..e14397e0d47 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -0,0 +1,197 @@ +/*--------------------------------------------------------------------------------------------- + * 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.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.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() + { + 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 + $previousEnv.psobject.properties | Foreach-Object { $env[$_.Name] = $_.Value } +} +# Add script method called AddWithCache to $env, when useCache is set true, it will try to get the value from the $env first. +# example: $val = $env.AddWithCache('key', $val, $true) +$env | Add-Member -Type ScriptMethod -Value { param( [string]$key, [object]$val, [bool]$useCache) if ($this.Contains($key) -and $useCache) { return $this[$key] } else { $this[$key] = $val; return $val } } -Name 'AddWithCache' +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +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(@"{ + $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 + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} +"); + + + sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); + var variants = variantGroup.Variants + .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) + .ToList(); + + 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) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs new file mode 100644 index 00000000000..12fbaf4bff5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs @@ -0,0 +1,52 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "CommonParameter")] + [OutputType(typeof(Dictionary))] + [DoNotExport] + public class GetCommonParameter : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSCmdlet PSCmdlet { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public Dictionary PSBoundParameter { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = PSCmdlet.MyInvocation.MyCommand.ToVariants(); + var commonParameterNames = variants.ToParameterGroups() + .Where(pg => pg.OrderCategory == ParameterCategory.Azure || pg.OrderCategory == ParameterCategory.Runtime) + .Select(pg => pg.ParameterName); + if (variants.Any(v => v.SupportsShouldProcess)) + { + commonParameterNames = commonParameterNames.Append("Confirm").Append("WhatIf"); + } + if (variants.Any(v => v.SupportsPaging)) + { + commonParameterNames = commonParameterNames.Append("First").Append("Skip").Append("IncludeTotalCount"); + } + + var names = commonParameterNames.ToArray(); + var keys = PSBoundParameter.Keys.Where(k => names.Contains(k)); + WriteObject(keys.ToDictionary(key => key, key => PSBoundParameter[key]), true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs new file mode 100644 index 00000000000..16bf7a26a2f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ModuleGuid")] + [DoNotExport] + public class GetModuleGuid : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + protected override void ProcessRecord() + { + try + { + WriteObject(ReadGuidFromPsd1(Psd1Path)); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs new file mode 100644 index 00000000000..919d743233d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs @@ -0,0 +1,54 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ScriptCmdlet")] + [OutputType(typeof(string[]))] + [DoNotExport] + public class GetScriptCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ScriptFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeDoNotExport { get; set; } + + [Parameter] + public SwitchParameter AsAlias { get; set; } + + [Parameter] + public SwitchParameter AsFunctionInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var functionInfos = GetScriptCmdlets(this, ScriptFolder) + .Where(fi => IncludeDoNotExport || !fi.ScriptBlock.Attributes.OfType().Any()) + .ToArray(); + if (AsFunctionInfo) + { + WriteObject(functionInfos, true); + return; + } + var aliases = functionInfos.SelectMany(i => i.ScriptBlock.Attributes).ToAliasNames(); + var names = functionInfos.Select(fi => fi.Name).Distinct(); + var output = (AsAlias ? aliases : names).DefaultIfEmpty("''").ToArray(); + WriteObject(output, true); + } + catch (System.Exception ee) + { + System.Console.Error.WriteLine($"{ee.GetType().Name}: {ee.Message}"); + System.Console.Error.WriteLine(ee.StackTrace); + throw ee; + } + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/CollectionExtensions.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/CollectionExtensions.cs new file mode 100644 index 00000000000..5cfba584aa5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/CollectionExtensions.cs @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + internal static class CollectionExtensions + { + public static T[] NullIfEmpty(this T[] collection) => (collection?.Any() ?? false) ? collection : null; + public static IEnumerable EmptyIfNull(this IEnumerable collection) => collection ?? Enumerable.Empty(); + + // https://stackoverflow.com/a/4158364/294804 + public static IEnumerable DistinctBy(this IEnumerable collection, Func selector) => + collection.GroupBy(selector).Select(group => group.First()); + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/MarkdownRenderer.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/MarkdownRenderer.cs new file mode 100644 index 00000000000..17c4db3f3ab --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -0,0 +1,122 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.IO; +using System.Linq; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsProxyOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + internal static class MarkdownRenderer + { + public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder, bool AddComplexInterfaceInfo = true) + { + Directory.CreateDirectory(docsFolder); + var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray(); + + foreach (var markdownInfo in markdownInfos) + { + var sb = new StringBuilder(); + sb.Append(markdownInfo.ToHelpMetadataOutput()); + sb.Append($"# {markdownInfo.CmdletName}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"## SYNOPSIS{Environment.NewLine}{markdownInfo.Synopsis.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## SYNTAX{Environment.NewLine}{Environment.NewLine}"); + var hasMultipleParameterSets = markdownInfo.SyntaxInfos.Length > 1; + foreach (var syntaxInfo in markdownInfo.SyntaxInfos) + { + sb.Append(syntaxInfo.ToHelpSyntaxOutput(hasMultipleParameterSets)); + } + + sb.Append($"## DESCRIPTION{Environment.NewLine}{markdownInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## EXAMPLES{Environment.NewLine}{Environment.NewLine}"); + foreach (var exampleInfo in markdownInfo.Examples) + { + sb.Append(exampleInfo.ToHelpExampleOutput()); + } + + sb.Append($"## PARAMETERS{Environment.NewLine}{Environment.NewLine}"); + foreach (var parameter in markdownInfo.Parameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + if (markdownInfo.SupportsShouldProcess) + { + foreach (var parameter in SupportsShouldProcessParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + + sb.Append($"### CommonParameters{Environment.NewLine}This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## INPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var input in markdownInfo.Inputs) + { + sb.Append($"### {input}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## OUTPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var output in markdownInfo.Outputs) + { + sb.Append($"### {output}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}"); + if (markdownInfo.Aliases.Any()) + { + sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); + } + foreach (var alias in markdownInfo.Aliases) + { + sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}"); + } + + if (AddComplexInterfaceInfo) + { + if (markdownInfo.ComplexInterfaceInfos.Any()) + { + sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + } + foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + { + sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + } + + } + + sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); + foreach (var relatedLink in markdownInfo.RelatedLinks) + { + sb.Append($"[{relatedLink}]({relatedLink}){Environment.NewLine}{Environment.NewLine}"); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString()); + } + + WriteModulePage(moduleHelpInfo, markdownInfos, docsFolder); + } + + private static void WriteModulePage(PsModuleHelpInfo moduleInfo, MarkdownHelpInfo[] markdownInfos, string docsFolder) + { + var sb = new StringBuilder(); + sb.Append(moduleInfo.ToModulePageMetadataOutput()); + sb.Append($"# {moduleInfo.Name} Module{Environment.NewLine}"); + sb.Append($"## Description{Environment.NewLine}{moduleInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## {moduleInfo.Name} Cmdlets{Environment.NewLine}"); + foreach (var markdownInfo in markdownInfos) + { + sb.Append(markdownInfo.ToModulePageCmdletOutput()); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{moduleInfo.Name}.md"), sb.ToString()); + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsFormatTypes.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsFormatTypes.cs new file mode 100644 index 00000000000..b27793e01e2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsFormatTypes.cs @@ -0,0 +1,138 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Linq; +using System.Reflection; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + internal class ViewParameters + { + public Type Type { get; } + public IEnumerable Properties { get; } + + public ViewParameters(Type type, IEnumerable properties) + { + Type = type; + Properties = properties; + } + } + + internal class PropertyFormat + { + public PropertyInfo Property { get; } + public FormatTableAttribute FormatTable { get; } + + public int? Index { get; } + public string Label { get; } + public int? Width { get; } + public PropertyOrigin? Origin { get; } + + public PropertyFormat(PropertyInfo propertyInfo) + { + Property = propertyInfo; + FormatTable = Property.GetCustomAttributes().FirstOrDefault(); + var origin = Property.GetCustomAttributes().FirstOrDefault(); + + Index = FormatTable?.HasIndex ?? false ? (int?)FormatTable.Index : null; + Label = FormatTable?.Label ?? propertyInfo.Name; + Width = FormatTable?.HasWidth ?? false ? (int?)FormatTable.Width : null; + // If we have an index, we don't want to use Origin. + Origin = FormatTable?.HasIndex ?? false ? null : origin?.Origin; + } + } + + [Serializable] + [XmlRoot(nameof(Configuration))] + public class Configuration + { + [XmlElement("ViewDefinitions")] + public ViewDefinitions ViewDefinitions { get; set; } + } + + [Serializable] + public class ViewDefinitions + { + //https://stackoverflow.com/a/10518657/294804 + [XmlElement("View")] + public List Views { get; set; } + } + + [Serializable] + public class View + { + [XmlElement(nameof(Name))] + public string Name { get; set; } + [XmlElement(nameof(ViewSelectedBy))] + public ViewSelectedBy ViewSelectedBy { get; set; } + [XmlElement(nameof(TableControl))] + public TableControl TableControl { get; set; } + } + + [Serializable] + public class ViewSelectedBy + { + [XmlElement(nameof(TypeName))] + public string TypeName { get; set; } + } + + [Serializable] + public class TableControl + { + [XmlElement(nameof(TableHeaders))] + public TableHeaders TableHeaders { get; set; } + [XmlElement(nameof(TableRowEntries))] + public TableRowEntries TableRowEntries { get; set; } + } + + [Serializable] + public class TableHeaders + { + [XmlElement("TableColumnHeader")] + public List TableColumnHeaders { get; set; } + } + + [Serializable] + public class TableColumnHeader + { + [XmlElement(nameof(Label))] + public string Label { get; set; } + [XmlElement(nameof(Width))] + public int? Width { get; set; } + + //https://stackoverflow.com/a/4095225/294804 + public bool ShouldSerializeWidth() => Width.HasValue; + } + + [Serializable] + public class TableRowEntries + { + [XmlElement(nameof(TableRowEntry))] + public TableRowEntry TableRowEntry { get; set; } + } + + [Serializable] + public class TableRowEntry + { + [XmlElement(nameof(TableColumnItems))] + public TableColumnItems TableColumnItems { get; set; } + } + + [Serializable] + public class TableColumnItems + { + [XmlElement("TableColumnItem")] + public List TableItems { get; set; } + } + + [Serializable] + public class TableColumnItem + { + [XmlElement(nameof(PropertyName))] + public string PropertyName { get; set; } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs new file mode 100644 index 00000000000..6eee4e46db2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs @@ -0,0 +1,199 @@ +/*--------------------------------------------------------------------------------------------- + * 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.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + internal class HelpMetadataOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public HelpMetadataOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"--- +external help file:{(!String.IsNullOrEmpty(HelpInfo.ExternalHelpFilename) ? $" {HelpInfo.ExternalHelpFilename}" : String.Empty)} +Module Name: {HelpInfo.ModuleName} +online version: {HelpInfo.OnlineVersion} +schema: {HelpInfo.Schema.ToString(3)} +--- + +"; + } + + internal class HelpSyntaxOutput + { + public MarkdownSyntaxHelpInfo SyntaxInfo { get; } + public bool HasMultipleParameterSets { get; } + + public HelpSyntaxOutput(MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) + { + SyntaxInfo = syntaxInfo; + HasMultipleParameterSets = hasMultipleParameterSets; + } + + public override string ToString() + { + var psnText = HasMultipleParameterSets ? $"### {SyntaxInfo.ParameterSetName}{(SyntaxInfo.IsDefault ? " (Default)" : String.Empty)}{Environment.NewLine}" : String.Empty; + return $@"{psnText}``` +{SyntaxInfo.SyntaxText} +``` + +"; + } + } + + internal class HelpExampleOutput + { + private string ExampleTemplate = + "{0}{1}" + Environment.NewLine + + "{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine + + "{5}" + Environment.NewLine + Environment.NewLine; + + private string ExampleTemplateWithOutput = + "{0}{1}" + Environment.NewLine + + "{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine + + "{5}" + Environment.NewLine + "{6}" + Environment.NewLine + "{7}" + Environment.NewLine + Environment.NewLine + + "{8}" + Environment.NewLine + Environment.NewLine; + + public MarkdownExampleHelpInfo ExampleInfo { get; } + + public HelpExampleOutput(MarkdownExampleHelpInfo exampleInfo) + { + ExampleInfo = exampleInfo; + } + + public override string ToString() + { + if (string.IsNullOrEmpty(ExampleInfo.Output)) + { + return string.Format(ExampleTemplate, + ExampleNameHeader, ExampleInfo.Name, + ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter, + ExampleInfo.Description.ToDescriptionFormat()); + } + else + { + return string.Format(ExampleTemplateWithOutput, + ExampleNameHeader, ExampleInfo.Name, + ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter, + ExampleOutputHeader, ExampleInfo.Output, ExampleOutputFooter, + ExampleInfo.Description.ToDescriptionFormat()); ; + } + } + } + + internal class HelpParameterOutput + { + public MarkdownParameterHelpInfo ParameterInfo { get; } + + public HelpParameterOutput(MarkdownParameterHelpInfo parameterInfo) + { + ParameterInfo = parameterInfo; + } + + public override string ToString() + { + var pipelineInputTypes = new[] + { + ParameterInfo.AcceptsPipelineByValue ? "ByValue" : String.Empty, + ParameterInfo.AcceptsPipelineByPropertyName ? "ByPropertyName" : String.Empty + }.JoinIgnoreEmpty(", "); + var pipelineInput = ParameterInfo.AcceptsPipelineByValue || ParameterInfo.AcceptsPipelineByPropertyName + ? $@"{true} ({pipelineInputTypes})" + : false.ToString(); + + return $@"### -{ParameterInfo.Name} +{ParameterInfo.Description.ToDescriptionFormat()} + +```yaml +Type: {ParameterInfo.Type.FullName} +Parameter Sets: {(ParameterInfo.HasAllParameterSets ? "(All)" : ParameterInfo.ParameterSetNames.JoinIgnoreEmpty(", "))} +Aliases:{(ParameterInfo.Aliases.Any() ? $" {ParameterInfo.Aliases.JoinIgnoreEmpty(", ")}" : String.Empty)} + +Required: {ParameterInfo.IsRequired} +Position: {ParameterInfo.Position} +Default value: {ParameterInfo.DefaultValue} +Accept pipeline input: {pipelineInput} +Accept wildcard characters: {ParameterInfo.AcceptsWildcardCharacters} +``` + +"; + } + } + + internal class ModulePageMetadataOutput + { + public PsModuleHelpInfo ModuleInfo { get; } + + private static string HelpLinkPrefix { get; } = @"https://learn.microsoft.com/powershell/module/"; + + public ModulePageMetadataOutput(PsModuleHelpInfo moduleInfo) + { + ModuleInfo = moduleInfo; + } + + public override string ToString() => $@"--- +Module Name: {ModuleInfo.Name} +Module Guid: {ModuleInfo.Guid} +Download Help Link: {HelpLinkPrefix}{ModuleInfo.Name.ToLowerInvariant()} +Help Version: 1.0.0.0 +Locale: en-US +--- + +"; + } + + internal class ModulePageCmdletOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public ModulePageCmdletOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"### [{HelpInfo.CmdletName}]({HelpInfo.CmdletName}.md) +{HelpInfo.Synopsis.ToDescriptionFormat()} + +"; + } + + internal static class PsHelpOutputExtensions + { + public static string EscapeAngleBrackets(this string text) => text?.Replace("<", @"\<").Replace(">", @"\>"); + public static string ReplaceSentenceEndWithNewline(this string text) => text?.Replace(". ", $".{Environment.NewLine}").Replace(". ", $".{Environment.NewLine}"); + public static string ReplaceBrWithNewline(this string text) => text?.Replace("
", $"{Environment.NewLine}"); + public static string ToDescriptionFormat(this string text, bool escapeAngleBrackets = true) + { + var description = text?.ReplaceBrWithNewline(); + description = escapeAngleBrackets ? description?.EscapeAngleBrackets() : description; + return description?.ReplaceSentenceEndWithNewline().Trim(); + } + + public const string ExampleNameHeader = "### "; + public const string ExampleCodeHeader = "```powershell"; + public const string ExampleCodeFooter = "```"; + public const string ExampleOutputHeader = "```output"; + public const string ExampleOutputFooter = "```"; + + public static HelpMetadataOutput ToHelpMetadataOutput(this MarkdownHelpInfo helpInfo) => new HelpMetadataOutput(helpInfo); + + public static HelpSyntaxOutput ToHelpSyntaxOutput(this MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) => new HelpSyntaxOutput(syntaxInfo, hasMultipleParameterSets); + + public static HelpExampleOutput ToHelpExampleOutput(this MarkdownExampleHelpInfo exampleInfo) => new HelpExampleOutput(exampleInfo); + + public static HelpParameterOutput ToHelpParameterOutput(this MarkdownParameterHelpInfo parameterInfo) => new HelpParameterOutput(parameterInfo); + + public static ModulePageMetadataOutput ToModulePageMetadataOutput(this PsModuleHelpInfo moduleInfo) => new ModulePageMetadataOutput(moduleInfo); + + public static ModulePageCmdletOutput ToModulePageCmdletOutput(this MarkdownHelpInfo helpInfo) => new ModulePageCmdletOutput(helpInfo); + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsHelpTypes.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsHelpTypes.cs new file mode 100644 index 00000000000..9f10f93be66 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsHelpTypes.cs @@ -0,0 +1,211 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + internal class PsHelpInfo + { + public string CmdletName { get; } + public string ModuleName { get; } + public string Synopsis { get; } + public string Description { get; } + public string AlertText { get; } + public string Category { get; } + public PsHelpLinkInfo OnlineVersion { get; } + public PsHelpLinkInfo[] RelatedLinks { get; } + public bool? HasCommonParameters { get; } + public bool? HasWorkflowCommonParameters { get; } + + public PsHelpTypeInfo[] InputTypes { get; } + public PsHelpTypeInfo[] OutputTypes { get; } + public PsHelpExampleInfo[] Examples { get; set; } + public string[] Aliases { get; } + + public PsParameterHelpInfo[] Parameters { get; } + public PsHelpSyntaxInfo[] Syntax { get; } + + public object Component { get; } + public object Functionality { get; } + public object PsSnapIn { get; } + public object Role { get; } + public string NonTerminatingErrors { get; } + + public static string CapitalizeFirstLetter(string text) + { + if (string.IsNullOrEmpty(text)) + return text; + + return char.ToUpper(text[0]) + text.Substring(1); + } + + public PsHelpInfo(PSObject helpObject = null) + { + helpObject = helpObject ?? new PSObject(); + CmdletName = helpObject.GetProperty("Name").NullIfEmpty() ?? helpObject.GetNestedProperty("details", "name"); + ModuleName = helpObject.GetProperty("ModuleName"); + Synopsis = CapitalizeFirstLetter(helpObject.GetProperty("Synopsis")); + Description = helpObject.GetProperty("description").EmptyIfNull().ToDescriptionText().NullIfEmpty() ?? + helpObject.GetNestedProperty("details", "description").EmptyIfNull().ToDescriptionText(); + Description = CapitalizeFirstLetter(Description); + AlertText = helpObject.GetNestedProperty("alertSet", "alert").EmptyIfNull().ToDescriptionText(); + Category = helpObject.GetProperty("Category"); + HasCommonParameters = helpObject.GetProperty("CommonParameters").ToNullableBool(); + HasWorkflowCommonParameters = helpObject.GetProperty("WorkflowCommonParameters").ToNullableBool(); + + var links = helpObject.GetNestedProperty("relatedLinks", "navigationLink").EmptyIfNull().Select(nl => nl.ToLinkInfo()).ToArray(); + OnlineVersion = links.FirstOrDefault(l => l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length == 1); + RelatedLinks = links.Where(l => !l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length != 1).ToArray(); + + InputTypes = helpObject.GetNestedProperty("inputTypes", "inputType").EmptyIfNull().Select(it => it.ToTypeInfo()).ToArray(); + OutputTypes = helpObject.GetNestedProperty("returnValues", "returnValue").EmptyIfNull().Select(rv => rv.ToTypeInfo()).ToArray(); + Examples = helpObject.GetNestedProperty("examples", "example").EmptyIfNull().Select(e => e.ToExampleInfo()).ToArray(); + Aliases = helpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + + Parameters = helpObject.GetNestedProperty("parameters", "parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + Syntax = helpObject.GetNestedProperty("syntax", "syntaxItem").EmptyIfNull().Select(si => si.ToSyntaxInfo()).ToArray(); + + Component = helpObject.GetProperty("Component"); + Functionality = helpObject.GetProperty("Functionality"); + PsSnapIn = helpObject.GetProperty("PSSnapIn"); + Role = helpObject.GetProperty("Role"); + NonTerminatingErrors = helpObject.GetProperty("nonTerminatingErrors"); + } + } + + internal class PsHelpTypeInfo + { + public string Name { get; } + public string Description { get; } + + public PsHelpTypeInfo(PSObject typeObject) + { + Name = typeObject.GetNestedProperty("type", "name").EmptyIfNull().Trim(); + Description = typeObject.GetProperty("description").EmptyIfNull().ToDescriptionText(); + } + } + + internal class PsHelpLinkInfo + { + public string Uri { get; } + public string Text { get; } + + public PsHelpLinkInfo(PSObject linkObject) + { + Uri = linkObject.GetProperty("uri"); + Text = linkObject.GetProperty("linkText"); + } + } + + internal class PsHelpSyntaxInfo + { + public string CmdletName { get; } + public PsParameterHelpInfo[] Parameters { get; } + + public PsHelpSyntaxInfo(PSObject syntaxObject) + { + CmdletName = syntaxObject.GetProperty("name"); + Parameters = syntaxObject.GetProperty("parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + } + } + + internal class PsHelpExampleInfo + { + public string Title { get; } + public string Code { get; } + public string Output { get; } + public string Remarks { get; } + + public PsHelpExampleInfo(PSObject exampleObject) + { + Title = exampleObject.GetProperty("title"); + Code = exampleObject.GetProperty("code"); + Output = exampleObject.GetProperty("output"); + Remarks = exampleObject.GetProperty("remarks").EmptyIfNull().ToDescriptionText(); + } + public PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) + { + Title = markdownExample.Name; + Code = markdownExample.Code; + Output = markdownExample.Output; + Remarks = markdownExample.Description; + } + + public static implicit operator PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) => new PsHelpExampleInfo(markdownExample); + } + + internal class PsParameterHelpInfo + { + public string DefaultValueAsString { get; } + + public string Name { get; } + public string TypeName { get; } + public string Description { get; } + public string SupportsPipelineInput { get; } + public string PositionText { get; } + public string[] ParameterSetNames { get; } + public string[] Aliases { get; } + + public bool? SupportsGlobbing { get; } + public bool? IsRequired { get; } + public bool? IsVariableLength { get; } + public bool? IsDynamic { get; } + + public PsParameterHelpInfo(PSObject parameterHelpObject = null) + { + parameterHelpObject = parameterHelpObject ?? new PSObject(); + DefaultValueAsString = parameterHelpObject.GetProperty("defaultValue"); + Name = parameterHelpObject.GetProperty("name"); + TypeName = parameterHelpObject.GetProperty("parameterValue").NullIfEmpty() ?? parameterHelpObject.GetNestedProperty("type", "name"); + Description = parameterHelpObject.GetProperty("Description").EmptyIfNull().ToDescriptionText(); + SupportsPipelineInput = parameterHelpObject.GetProperty("pipelineInput"); + PositionText = parameterHelpObject.GetProperty("position"); + ParameterSetNames = parameterHelpObject.GetProperty("parameterSetName").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + Aliases = parameterHelpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + + SupportsGlobbing = parameterHelpObject.GetProperty("globbing").ToNullableBool(); + IsRequired = parameterHelpObject.GetProperty("required").ToNullableBool(); + IsVariableLength = parameterHelpObject.GetProperty("variableLength").ToNullableBool(); + IsDynamic = parameterHelpObject.GetProperty("isDynamic").ToNullableBool(); + } + } + + internal class PsModuleHelpInfo + { + public string Name { get; } + public Guid Guid { get; } + public string Description { get; } + + public PsModuleHelpInfo(PSModuleInfo moduleInfo) + : this(moduleInfo?.Name ?? String.Empty, moduleInfo?.Guid ?? Guid.NewGuid(), moduleInfo?.Description ?? String.Empty) + { + } + + public PsModuleHelpInfo(string name, Guid guid, string description) + { + Name = name; + Guid = guid; + Description = description; + } + } + + internal static class HelpTypesExtensions + { + public static PsHelpInfo ToPsHelpInfo(this PSObject helpObject) => new PsHelpInfo(helpObject); + public static PsParameterHelpInfo ToPsParameterHelpInfo(this PSObject parameterHelpObject) => new PsParameterHelpInfo(parameterHelpObject); + + public static string ToDescriptionText(this IEnumerable descriptionObject) => descriptionObject != null + ? String.Join(Environment.NewLine, descriptionObject.Select(dl => dl.GetProperty("Text").EmptyIfNull())).NullIfWhiteSpace() + : null; + public static PsHelpTypeInfo ToTypeInfo(this PSObject typeObject) => new PsHelpTypeInfo(typeObject); + public static PsHelpExampleInfo ToExampleInfo(this PSObject exampleObject) => new PsHelpExampleInfo(exampleObject); + public static PsHelpLinkInfo ToLinkInfo(this PSObject linkObject) => new PsHelpLinkInfo(linkObject); + public static PsHelpSyntaxInfo ToSyntaxInfo(this PSObject syntaxObject) => new PsHelpSyntaxInfo(syntaxObject); + public static PsModuleHelpInfo ToModuleInfo(this PSModuleInfo moduleInfo) => new PsModuleHelpInfo(moduleInfo); + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs new file mode 100644 index 00000000000..8746381a7e5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs @@ -0,0 +1,329 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + internal class MarkdownHelpInfo + { + public string ExternalHelpFilename { get; } + public string ModuleName { get; } + public string OnlineVersion { get; } + public Version Schema { get; } + + public string CmdletName { get; } + public string[] Aliases { get; } + public string Synopsis { get; } + public string Description { get; } + + public MarkdownSyntaxHelpInfo[] SyntaxInfos { get; } + public MarkdownExampleHelpInfo[] Examples { get; } + public MarkdownParameterHelpInfo[] Parameters { get; } + + public string[] Inputs { get; } + public string[] Outputs { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + public MarkdownRelatedLinkInfo[] RelatedLinks { get; } + + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string externalHelpFilename = "") + { + ExternalHelpFilename = externalHelpFilename; + ModuleName = variantGroup.RootModuleName != "" ? variantGroup.RootModuleName : variantGroup.ModuleName; + var helpInfo = variantGroup.HelpInfo; + var commentInfo = variantGroup.CommentInfo; + Schema = Version.Parse("2.0.0"); + + CmdletName = variantGroup.CmdletName; + Aliases = (variantGroup.Aliases.NullIfEmpty() ?? helpInfo.Aliases).Where(a => a != "None").ToArray(); + Synopsis = commentInfo.Synopsis; + Description = commentInfo.Description; + + SyntaxInfos = variantGroup.Variants + .Select(v => new MarkdownSyntaxHelpInfo(v, variantGroup.ParameterGroups, v.VariantName == variantGroup.DefaultParameterSetName)) + .OrderByDescending(v => v.IsDefault).ThenBy(v => v.ParameterSetName).ToArray(); + Examples = GetExamplesFromMarkdown(examplesFolder).NullIfEmpty() + ?? helpInfo.Examples.Select(e => e.ToExampleHelpInfo()).ToArray().NullIfEmpty() + ?? DefaultExampleHelpInfos; + + Parameters = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && !pg.Parameters.All(p => p.IsHidden())) + .Select(pg => new MarkdownParameterHelpInfo( + variantGroup.Variants.SelectMany(v => v.HelpInfo.Parameters).Where(phi => phi.Name == pg.ParameterName).ToArray(), pg)) + .OrderBy(phi => phi.Name).ToArray(); + + Inputs = commentInfo.Inputs; + Outputs = commentInfo.Outputs; + + ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos; + OnlineVersion = commentInfo.OnlineVersion; + + 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; + } + + private MarkdownExampleHelpInfo[] GetExamplesFromMarkdown(string examplesFolder) + { + var filePath = Path.Combine(examplesFolder, $"{CmdletName}.md"); + if (!Directory.Exists(examplesFolder) || !File.Exists(filePath)) return null; + + var lines = File.ReadAllLines(filePath); + var nameIndices = lines.Select((l, i) => l.StartsWith(ExampleNameHeader) ? i : -1).Where(i => i != -1).ToArray(); + //https://codereview.stackexchange.com/a/187148/68772 + var indexCountGroups = nameIndices.Skip(1).Append(lines.Length).Zip(nameIndices, (next, current) => (NameIndex: current, LineCount: next - current)); + var exampleGroups = indexCountGroups.Select(icg => lines.Skip(icg.NameIndex).Take(icg.LineCount).ToArray()); + return exampleGroups.Select(eg => + { + var name = eg.First().Replace(ExampleNameHeader, String.Empty); + var codeStartIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var codeEndIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i != codeStartIndex); + var code = codeStartIndex.HasValue && codeEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(codeStartIndex.Value + 1).Take(codeEndIndex.Value - (codeStartIndex.Value + 1))) + : String.Empty; + var outputStartIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var outputEndIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i > outputStartIndex); + var output = outputStartIndex.HasValue && outputEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(outputStartIndex.Value + 1).Take(outputEndIndex.Value - (outputStartIndex.Value + 1))) + : String.Empty; + var descriptionStartIndex = (outputEndIndex ?? (codeEndIndex ?? 0)) + 1; + descriptionStartIndex = String.IsNullOrWhiteSpace(eg[descriptionStartIndex]) ? descriptionStartIndex + 1 : descriptionStartIndex; + var descriptionEndIndex = eg.Length - 1; + descriptionEndIndex = String.IsNullOrWhiteSpace(eg[descriptionEndIndex]) ? descriptionEndIndex - 1 : descriptionEndIndex; + var description = String.Join(Environment.NewLine, eg.Skip(descriptionStartIndex).Take((descriptionEndIndex + 1) - descriptionStartIndex)); + return new MarkdownExampleHelpInfo(name, code, output, description); + }).ToArray(); + } + } + + internal class MarkdownSyntaxHelpInfo + { + public Variant Variant { get; } + public bool IsDefault { get; } + public string ParameterSetName { get; } + public Parameter[] Parameters { get; } + public string SyntaxText { get; } + + public MarkdownSyntaxHelpInfo(Variant variant, ParameterGroup[] parameterGroups, bool isDefault) + { + Variant = variant; + IsDefault = isDefault; + ParameterSetName = Variant.VariantName; + Parameters = Variant.Parameters + .Where(p => !p.DontShow && !p.IsHidden()).OrderByDescending(p => p.IsMandatory) + //https://stackoverflow.com/a/6461526/294804 + .ThenByDescending(p => p.Position.HasValue).ThenBy(p => p.Position) + // Use the OrderCategory of the parameter group because the final order category is the highest of the group, and not the order category of the individual parameters from the variants. + .ThenBy(p => parameterGroups.First(pg => pg.ParameterName == p.ParameterName).OrderCategory).ThenBy(p => p.ParameterName).ToArray(); + SyntaxText = CreateSyntaxFormat(); + } + + //https://github.com/PowerShell/platyPS/blob/a607a926bfffe1e1a1e53c19e0057eddd0c07611/src/Markdown.MAML/Renderer/Markdownv2Renderer.cs#L29-L32 + private const int SyntaxLineWidth = 110; + private string CreateSyntaxFormat() + { + var parameterStrings = Parameters.Select(p => p.ToPropertySyntaxOutput().ToString()); + if (Variant.SupportsShouldProcess) + { + parameterStrings = parameterStrings.Append(" [-Confirm]").Append(" [-WhatIf]"); + } + parameterStrings = parameterStrings.Append(" []"); + + var lines = new List(20); + return parameterStrings.Aggregate(Variant.CmdletName, (current, ps) => + { + var combined = current + ps; + if (combined.Length <= SyntaxLineWidth) return combined; + + lines.Add(current); + return ps; + }, last => + { + lines.Add(last); + return String.Join(Environment.NewLine, lines); + }); + } + } + + internal class MarkdownExampleHelpInfo + { + public string Name { get; } + public string Code { get; } + public string Output { get; } + public string Description { get; } + + public MarkdownExampleHelpInfo(string name, string code, string output, string description) + { + Name = name; + Code = code; + Output = output; + Description = description; + } + } + + internal class MarkdownParameterHelpInfo + { + public string Name { get; set; } + public string Description { get; set; } + public Type Type { get; set; } + public string Position { get; set; } + public string DefaultValue { get; set; } + + public bool HasAllParameterSets { get; set; } + public string[] ParameterSetNames { get; set; } + public string[] Aliases { get; set; } + + public bool IsRequired { get; set; } + public bool IsDynamic { get; set; } + public bool AcceptsPipelineByValue { get; set; } + public bool AcceptsPipelineByPropertyName { get; set; } + public bool AcceptsWildcardCharacters { get; set; } + + // For use by common parameters that have no backing data in the objects themselves. + public MarkdownParameterHelpInfo() { } + + public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, ParameterGroup parameterGroup) + { + Name = parameterGroup.ParameterName; + Description = parameterGroup.Description.NullIfEmpty() + ?? parameterHelpInfos.Select(phi => phi.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + Type = parameterGroup.ParameterType; + Position = parameterGroup.FirstPosition?.ToString() + ?? parameterHelpInfos.Select(phi => phi.PositionText).FirstOrDefault(d => !String.IsNullOrEmpty(d)).ToUpperFirstCharacter().NullIfEmpty() + ?? "Named"; + // This no longer uses firstHelpInfo.DefaultValueAsString since it seems to be broken. For example, it has a value of 0 for Int32, but no default value was declared. + DefaultValue = parameterGroup.DefaultInfo?.Script ?? "None"; + + HasAllParameterSets = parameterGroup.HasAllVariants; + ParameterSetNames = (parameterGroup.Parameters.Select(p => p.VariantName).ToArray().NullIfEmpty() + ?? parameterHelpInfos.SelectMany(phi => phi.ParameterSetNames).Distinct()) + .OrderBy(psn => psn).ToArray(); + Aliases = parameterGroup.Aliases.NullIfEmpty() ?? parameterHelpInfos.SelectMany(phi => phi.Aliases).ToArray(); + + IsRequired = parameterHelpInfos.Select(phi => phi.IsRequired).FirstOrDefault(r => r == true) ?? parameterGroup.Parameters.Any(p => p.IsMandatory); + IsDynamic = parameterHelpInfos.Select(phi => phi.IsDynamic).FirstOrDefault(d => d == true) ?? false; + AcceptsPipelineByValue = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByValue")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipeline; + AcceptsPipelineByPropertyName = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByPropertyName")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipelineByPropertyName; + AcceptsWildcardCharacters = parameterGroup.SupportsWildcards; + } + } + + 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 (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 = + { + new MarkdownParameterHelpInfo + { + Name = "Confirm", + Description ="Prompts you for confirmation before running the cmdlet.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "cf" } + }, + new MarkdownParameterHelpInfo + { + Name = "WhatIf", + Description ="Shows what would happen if the cmdlet runs. The cmdlet is not run.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "wi" } + } + }; + + public static MarkdownParameterHelpInfo[] SupportsPagingParameters = + { + new MarkdownParameterHelpInfo + { + Name = "First", + Description ="Gets only the first 'n' objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "IncludeTotalCount", + Description ="Reports the number of objects in the data set (an integer) followed by the objects. If the cmdlet cannot determine the total count, it returns \"Unknown total count\".", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "Skip", + Description ="Ignores the first 'n' objects and then gets the remaining objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + } + }; + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsProxyOutputs.cs new file mode 100644 index 00000000000..c222742015d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -0,0 +1,681 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + internal class OutputTypeOutput + { + public PSTypeName[] OutputTypes { get; } + + public OutputTypeOutput(IEnumerable outputTypes) + { + OutputTypes = outputTypes.ToArray(); + } + + public override string ToString() => OutputTypes != null && OutputTypes.Any() ? $"[OutputType({OutputTypes.Select(ot => $"[{ot}]").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class CmdletBindingOutput + { + public VariantGroup VariantGroup { get; } + + public CmdletBindingOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() + { + var dpsText = VariantGroup.DefaultParameterSetName.IsValidDefaultParameterSetName() ? $"DefaultParameterSetName='{VariantGroup.DefaultParameterSetName}'" : String.Empty; + var sspText = VariantGroup.SupportsShouldProcess ? $"SupportsShouldProcess{ItemSeparator}ConfirmImpact='Medium'" : String.Empty; + var pbText = $"PositionalBinding={false.ToPsBool()}"; + var propertyText = new[] { dpsText, pbText, sspText }.JoinIgnoreEmpty(ItemSeparator); + return $"[CmdletBinding({propertyText})]{Environment.NewLine}"; + } + } + + internal class ParameterOutput + { + public Parameter Parameter { get; } + public bool HasMultipleVariantsInVariantGroup { get; } + public bool HasAllVariantsInParameterGroup { get; } + + public ParameterOutput(Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) + { + Parameter = parameter; + HasMultipleVariantsInVariantGroup = hasMultipleVariantsInVariantGroup; + HasAllVariantsInParameterGroup = hasAllVariantsInParameterGroup; + } + + public override string ToString() + { + var psnText = HasMultipleVariantsInVariantGroup && !HasAllVariantsInParameterGroup ? $"ParameterSetName='{Parameter.VariantName}'" : String.Empty; + var positionText = Parameter.Position != null ? $"Position={Parameter.Position}" : String.Empty; + var mandatoryText = Parameter.IsMandatory ? "Mandatory" : String.Empty; + var dontShowText = Parameter.DontShow ? "DontShow" : String.Empty; + var vfpText = Parameter.ValueFromPipeline ? "ValueFromPipeline" : String.Empty; + var vfpbpnText = Parameter.ValueFromPipelineByPropertyName ? "ValueFromPipelineByPropertyName" : String.Empty; + var propertyText = new[] { psnText, positionText, mandatoryText, dontShowText, vfpText, vfpbpnText }.JoinIgnoreEmpty(ItemSeparator); + return $"{Indent}[Parameter({propertyText})]{Environment.NewLine}"; + } + } + + internal class AliasOutput + { + public string[] Aliases { get; } + public bool IncludeIndent { get; } + + public AliasOutput(string[] aliases, bool includeIndent = false) + { + Aliases = aliases; + IncludeIndent = includeIndent; + } + + public override string ToString() => Aliases?.Any() ?? false ? $"{(IncludeIndent ? Indent : String.Empty)}[Alias({Aliases.Select(an => $"'{an}'").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class ValidateNotNullOutput + { + public bool HasValidateNotNull { get; } + + public ValidateNotNullOutput(bool hasValidateNotNull) + { + HasValidateNotNull = hasValidateNotNull; + } + + public override string ToString() => HasValidateNotNull ? $"{Indent}[ValidateNotNull()]{Environment.NewLine}" : String.Empty; + } + + internal class AllowEmptyArrayOutput + { + public bool HasAllowEmptyArray { get; } + + public AllowEmptyArrayOutput(bool hasAllowEmptyArray) + { + HasAllowEmptyArray = hasAllowEmptyArray; + } + + public override string ToString() => HasAllowEmptyArray ? $"{Indent}[AllowEmptyCollection()]{Environment.NewLine}" : String.Empty; + } + internal class ArgumentCompleterOutput + { + public CompleterInfo CompleterInfo { get; } + + public ArgumentCompleterOutput(CompleterInfo completerInfo) + { + CompleterInfo = completerInfo; + } + + public override string ToString() => CompleterInfo != null + ? $"{Indent}[ArgumentCompleter({(CompleterInfo.IsTypeCompleter ? $"[{CompleterInfo.Type.Unwrap().ToPsType()}]" : $"{{{CompleterInfo.Script.ToPsSingleLine("; ")}}}")})]{Environment.NewLine}" + : 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; } + public DefaultInfo DefaultInfo { get; } + + public DefaultInfoOutput(ParameterGroup parameterGroup) + { + HasDefaultInfo = parameterGroup.HasDefaultInfo; + DefaultInfo = parameterGroup.DefaultInfo; + } + + public override string ToString() + { + var nameText = !String.IsNullOrEmpty(DefaultInfo?.Name) ? $"Name='{DefaultInfo?.Name}'" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(DefaultInfo?.Description) ? $"Description='{DefaultInfo?.Description.ToPsStringLiteral()}'" : String.Empty; + var scriptText = !String.IsNullOrEmpty(DefaultInfo?.Script) ? $"Script='{DefaultInfo?.Script.ToPsSingleLine("; ")}'" : String.Empty; + var propertyText = new[] { nameText, descriptionText, scriptText }.JoinIgnoreEmpty(ItemSeparator); + return HasDefaultInfo ? $"{Indent}[{typeof(DefaultInfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class ParameterTypeOutput + { + public Type ParameterType { get; } + + public ParameterTypeOutput(Type parameterType) + { + ParameterType = parameterType; + } + + public override string ToString() => $"{Indent}[{ParameterType.ToPsType()}]{Environment.NewLine}"; + } + + internal class ParameterNameOutput + { + public string ParameterName { get; } + public bool IsLast { get; } + + public ParameterNameOutput(string parameterName, bool isLast) + { + ParameterName = parameterName; + IsLast = isLast; + } + + public override string ToString() => $"{Indent}${{{ParameterName}}}{(IsLast ? String.Empty : $",{Environment.NewLine}")}{Environment.NewLine}"; + } + + internal class BaseOutput + { + public VariantGroup VariantGroup { get; } + + protected static readonly bool IsAzure = Convert.ToBoolean(@"true"); + + public BaseOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + public string ClearTelemetryContext() + { + return (!VariantGroup.IsInternal && IsAzure) ? $@"{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext()" : ""; + } + } + + internal class BeginOutput : BaseOutput + { + public BeginOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + public string GetProcessCustomAttributesAtRuntime() + { + return VariantGroup.IsInternal ? "" : IsAzure ? $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet] +{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){{ +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) +{Indent}{Indent}}}" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.DataBox.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) + { + return $@" +{Indent}{Indent}if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {{ +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() +{Indent}{Indent}}} +{Indent}{Indent}$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId +{Indent}{Indent}if ($preTelemetryId -eq '') {{ +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.DataBox.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}}} else {{ +{Indent}{Indent}{Indent}$internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets +{Indent}{Indent}{Indent}if ($internalCalledCmdlets -eq '') {{ +{Indent}{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name +{Indent}{Indent}{Indent}}} else {{ +{Indent}{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name +{Indent}{Indent}{Indent}}} +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' +{Indent}{Indent}}} +"; + } + return ""; + } + public override string ToString() => $@"begin {{ +{Indent}try {{ +{Indent}{Indent}$outBuffer = $null +{Indent}{Indent}if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {{ +{Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1 +{Indent}{Indent}}} +{Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName +{Indent}{Indent} +{Indent}{Indent}$testPlayback = $false +{Indent}{Indent}$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object {{ if ($_) {{ $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.DataBox.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) +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +}} + +"; + + private string GetParameterSetToCmdletMapping() + { + var sb = new StringBuilder(); + sb.AppendLine($"{Indent}{Indent}$mapping = @{{"); + foreach (var variant in VariantGroup.Variants) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}{variant.VariantName} = '{variant.PrivateModuleName}\{variant.PrivateCmdletName}';"); + } + sb.Append($"{Indent}{Indent}}}"); + return sb.ToString(); + } + + private string GetDefaultValuesStatements() + { + var defaultInfos = VariantGroup.ParameterGroups.Where(pg => pg.HasDefaultInfo).Select(pg => pg.DefaultInfo).ToArray(); + var sb = new StringBuilder(); + + foreach (var defaultInfo in defaultInfos) + { + 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}'){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 {{"); + sb.AppendLine($"{Indent}{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}"); + sb.AppendLine($"{Indent}{Indent}{Indent}}}"); + sb.Append($"{Indent}{Indent}}}"); + } + else + { + 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 + { + public ProcessOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + private string GetFinally() + { + if (IsAzure && !VariantGroup.IsInternal) + { + return $@" +{Indent}finally {{ +{Indent}{Indent}$backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId +{Indent}{Indent}$backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() +{Indent}}} +"; + } + return ""; + } + public override string ToString() => $@"process {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.Process($_) +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +{GetFinally()} +}} +"; + } + + internal class EndOutput : BaseOutput + { + public EndOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + private string GetTelemetry() + { + if (!VariantGroup.IsInternal && IsAzure) + { + return $@" +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets +{Indent}{Indent}if ($preTelemetryId -eq '') {{ +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.DataBox.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() +{Indent}{Indent}}} +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId +"; + } + return ""; + } + public override string ToString() => $@"end {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.End() +{GetTelemetry()} +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +}} +"; + } + + internal class HelpCommentOutput + { + public VariantGroup VariantGroup { get; } + public CommentInfo CommentInfo { get; } + + public HelpCommentOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + CommentInfo = variantGroup.CommentInfo; + } + + public override string ToString() + { + var inputs = String.Join(Environment.NewLine, CommentInfo.Inputs.Select(i => $".Inputs{Environment.NewLine}{i}")); + var inputsText = !String.IsNullOrEmpty(inputs) ? $"{Environment.NewLine}{inputs}" : String.Empty; + var outputs = String.Join(Environment.NewLine, CommentInfo.Outputs.Select(o => $".Outputs{Environment.NewLine}{o}")); + var outputsText = !String.IsNullOrEmpty(outputs) ? $"{Environment.NewLine}{outputs}" : String.Empty; + var notes = String.Join($"{Environment.NewLine}{Environment.NewLine}", VariantGroup.ComplexInterfaceInfos.Select(cii => cii.ToNoteOutput())); + 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) + { + examples = examples + ".Example" + "\r\n" + example.Code + "\r\n"; + } + return $@"<# +.Synopsis +{CommentInfo.Synopsis.ToDescriptionFormat(false)} +.Description +{CommentInfo.Description.ToDescriptionFormat(false)} +{examples}{inputsText}{outputsText}{notesText} +.Link +{CommentInfo.OnlineVersion}{relatedLinksText}{externalUrlsText} +#> +"; + } + } + + internal class ParameterDescriptionOutput + { + public string Description { get; } + + public ParameterDescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) + ? Description.ToDescriptionFormat(false).NormalizeNewLines() + .Split(new[] { Environment.NewLine }, StringSplitOptions.None) + .Aggregate(String.Empty, (c, n) => c + $"{Indent}# {n}{Environment.NewLine}") + : String.Empty; + } + + internal class ProfileOutput + { + public string ProfileName { get; } + + public ProfileOutput(string profileName) + { + ProfileName = profileName; + } + + public override string ToString() => ProfileName != NoProfiles ? $"[{typeof(ProfileAttribute).ToPsAttributeType()}('{ProfileName}')]{Environment.NewLine}" : String.Empty; + } + + internal class DescriptionOutput + { + public string Description { get; } + + public DescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) ? $"[{typeof(DescriptionAttribute).ToPsAttributeType()}('{Description.ToPsStringLiteral()}')]{Environment.NewLine}" : String.Empty; + } + + internal class ParameterCategoryOutput + { + public ParameterCategory Category { get; } + + public ParameterCategoryOutput(ParameterCategory category) + { + Category = category; + } + + public override string ToString() => $"{Indent}[{typeof(CategoryAttribute).ToPsAttributeType()}('{Category}')]{Environment.NewLine}"; + } + + internal class InfoOutput + { + public InfoAttribute Info { get; } + public Type ParameterType { get; } + + public InfoOutput(InfoAttribute info, Type parameterType) + { + Info = info; + ParameterType = parameterType; + } + + public override string ToString() + { + // Rendering of InfoAttribute members that are not used currently + /*var serializedNameText = Info.SerializedName != null ? $"SerializedName='{Info.SerializedName}'" : String.Empty; + var readOnlyText = Info.ReadOnly ? "ReadOnly" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(Info.Description) ? $"Description='{Info.Description.ToPsStringLiteral()}'" : String.Empty;*/ + + var requiredText = Info.Required ? "Required" : String.Empty; + var unwrappedType = ParameterType.Unwrap(); + var hasValidPossibleTypes = Info.PossibleTypes.Any(pt => pt != unwrappedType); + var possibleTypesText = hasValidPossibleTypes + ? $"PossibleTypes=({Info.PossibleTypes.Select(pt => $"[{pt.ToPsType()}]").JoinIgnoreEmpty(ItemSeparator)})" + : String.Empty; + var propertyText = new[] { /*serializedNameText, */requiredText,/* readOnlyText,*/ possibleTypesText/*, descriptionText*/ }.JoinIgnoreEmpty(ItemSeparator); + return hasValidPossibleTypes ? $"{Indent}[{typeof(InfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class PropertySyntaxOutput + { + public string ParameterName { get; } + public Type ParameterType { get; } + public bool IsMandatory { get; } + public int? Position { get; } + + public bool IncludeSpace { get; } + public bool IncludeDash { get; } + + public PropertySyntaxOutput(Parameter parameter) + { + ParameterName = parameter.ParameterName; + ParameterType = parameter.ParameterType; + IsMandatory = parameter.IsMandatory; + Position = parameter.Position; + IncludeSpace = true; + IncludeDash = true; + } + + public PropertySyntaxOutput(ComplexInterfaceInfo complexInterfaceInfo) + { + ParameterName = complexInterfaceInfo.Name; + ParameterType = complexInterfaceInfo.Type; + IsMandatory = complexInterfaceInfo.Required; + Position = null; + IncludeSpace = false; + IncludeDash = false; + } + + public override string ToString() + { + var leftOptional = !IsMandatory ? "[" : String.Empty; + var leftPositional = Position != null ? "[" : String.Empty; + var rightPositional = Position != null ? "]" : String.Empty; + var type = ParameterType != typeof(SwitchParameter) ? $" <{ParameterType.ToSyntaxTypeName()}>" : String.Empty; + var rightOptional = !IsMandatory ? "]" : String.Empty; + var space = IncludeSpace ? " " : String.Empty; + var dash = IncludeDash ? "-" : String.Empty; + return $"{space}{leftOptional}{leftPositional}{dash}{ParameterName}{rightPositional}{type}{rightOptional}"; + } + } + + internal static class PsProxyOutputExtensions + { + public const string NoParameters = "__NoParameters"; + + public const string AllParameterSets = "__AllParameterSets"; + + public const string HalfIndent = " "; + + public const string Indent = HalfIndent + HalfIndent; + + public const string ItemSeparator = ", "; + + public static readonly string ComplexParameterHeader = $"COMPLEX PARAMETER PROPERTIES{Environment.NewLine}{Environment.NewLine}To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.{Environment.NewLine}{Environment.NewLine}"; + + public static string ToPsBool(this bool value) => $"${value.ToString().ToLowerInvariant()}"; + + public static string ToPsType(this Type type) + { + var regex = new Regex(@"^(.*)`{1}\d+(.*)$"); + var typeText = type.ToString(); + var match = regex.Match(typeText); + return match.Success ? $"{match.Groups[1]}{match.Groups[2]}" : typeText; + } + + public static string ToPsAttributeType(this Type type) => type.ToPsType().RemoveEnd("Attribute"); + + // https://stackoverflow.com/a/5284606/294804 + private static string RemoveEnd(this string text, string suffix) => text.EndsWith(suffix) ? text.Substring(0, text.Length - suffix.Length) : text; + + public static string ToPsSingleLine(this string value, string replacer = " ") => value.ReplaceNewLines(replacer, new[] { "
", "\r\n", "\n" }); + + public static string ToPsStringLiteral(this string value) => value?.Replace("'", "''").Replace("‘", "''").Replace("’", "''").ToPsSingleLine().Trim() ?? String.Empty; + + public static string JoinIgnoreEmpty(this IEnumerable values, string separator) => String.Join(separator, values?.Where(v => !String.IsNullOrEmpty(v))); + + // https://stackoverflow.com/a/41961738/294804 + public static string ToSyntaxTypeName(this Type type) + { + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return $"{type.GetGenericArguments().First().ToSyntaxTypeName()}?"; + } + + if (type.IsGenericType) + { + var genericTypes = String.Join(ItemSeparator, type.GetGenericArguments().Select(ToSyntaxTypeName)); + return $"{type.Name.Split('`').First()}<{genericTypes}>"; + } + + return type.Name; + } + + public static OutputTypeOutput ToOutputTypeOutput(this IEnumerable outputTypes) => new OutputTypeOutput(outputTypes); + + public static CmdletBindingOutput ToCmdletBindingOutput(this VariantGroup variantGroup) => new CmdletBindingOutput(variantGroup); + + public static ParameterOutput ToParameterOutput(this Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) => new ParameterOutput(parameter, hasMultipleVariantsInVariantGroup, hasAllVariantsInParameterGroup); + + public static AliasOutput ToAliasOutput(this string[] aliases, bool includeIndent = false) => new AliasOutput(aliases, includeIndent); + + public static ValidateNotNullOutput ToValidateNotNullOutput(this bool hasValidateNotNull) => new ValidateNotNullOutput(hasValidateNotNull); + + public static AllowEmptyArrayOutput ToAllowEmptyArray(this bool hasAllowEmptyArray) => new AllowEmptyArrayOutput(hasAllowEmptyArray); + + 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); + + public static ParameterTypeOutput ToParameterTypeOutput(this Type parameterType) => new ParameterTypeOutput(parameterType); + + public static ParameterNameOutput ToParameterNameOutput(this string parameterName, bool isLast) => new ParameterNameOutput(parameterName, isLast); + + public static BeginOutput ToBeginOutput(this VariantGroup variantGroup) => new BeginOutput(variantGroup); + + public static ProcessOutput ToProcessOutput(this VariantGroup variantGroup) => new ProcessOutput(variantGroup); + + public static EndOutput ToEndOutput(this VariantGroup variantGroup) => new EndOutput(variantGroup); + + public static HelpCommentOutput ToHelpCommentOutput(this VariantGroup variantGroup) => new HelpCommentOutput(variantGroup); + + public static ParameterDescriptionOutput ToParameterDescriptionOutput(this string description) => new ParameterDescriptionOutput(description); + + public static ProfileOutput ToProfileOutput(this string profileName) => new ProfileOutput(profileName); + + public static DescriptionOutput ToDescriptionOutput(this string description) => new DescriptionOutput(description); + + public static ParameterCategoryOutput ToParameterCategoryOutput(this ParameterCategory category) => new ParameterCategoryOutput(category); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this Parameter parameter) => new PropertySyntaxOutput(parameter); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this ComplexInterfaceInfo complexInterfaceInfo) => new PropertySyntaxOutput(complexInterfaceInfo); + + public static InfoOutput ToInfoOutput(this InfoAttribute info, Type parameterType) => new InfoOutput(info, parameterType); + + public static string ToNoteOutput(this ComplexInterfaceInfo complexInterfaceInfo, string currentIndent = "", bool includeDashes = false, bool includeBackticks = false, bool isFirst = true) + { + string RenderProperty(ComplexInterfaceInfo info, string indent, bool dash, bool backtick) => + $"{indent}{(dash ? "- " : String.Empty)}{(backtick ? "`" : String.Empty)}{info.ToPropertySyntaxOutput()}{(backtick ? "`" : String.Empty)}: {info.Description}"; + + var nested = complexInterfaceInfo.NestedInfos.Select(ni => + { + var nestedIndent = $"{currentIndent}{HalfIndent}"; + return ni.IsComplexInterface + ? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false) + : RenderProperty(ni, nestedIndent, includeDashes, includeBackticks); + }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, includeBackticks)); + return String.Join(Environment.NewLine, nested); + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsProxyTypes.cs new file mode 100644 index 00000000000..41bd8920f44 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -0,0 +1,549 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + internal class ProfileGroup + { + public string ProfileName { get; } + public Variant[] Variants { get; } + public string ProfileFolder { get; } + + public ProfileGroup(Variant[] variants, string profileName = NoProfiles) + { + ProfileName = profileName; + Variants = variants; + ProfileFolder = ProfileName != NoProfiles ? ProfileName : String.Empty; + } + } + + internal class VariantGroup + { + public string ModuleName { get; } + + public string RootModuleName { get => @""; } + public string CmdletName { get; } + public string CmdletVerb { get; } + public string CmdletNoun { get; } + public string ProfileName { get; } + public Variant[] Variants { get; } + public ParameterGroup[] ParameterGroups { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + + public string[] Aliases { get; } + public PSTypeName[] OutputTypes { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + public string DefaultParameterSetName { get; } + public bool HasMultipleVariants { get; } + 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; } + + public CommentInfo CommentInfo { get; } + + public VariantGroup(string moduleName, string cmdletName, Variant[] variants, string outputFolder, string profileName = NoProfiles, bool isTest = false, bool isInternal = false) + { + ModuleName = moduleName; + CmdletName = cmdletName; + var cmdletNameParts = CmdletName.Split('-'); + CmdletVerb = cmdletNameParts.First(); + CmdletNoun = cmdletNameParts.Last(); + ProfileName = profileName; + Variants = variants; + ParameterGroups = Variants.ToParameterGroups().OrderBy(pg => pg.OrderCategory).ThenByDescending(pg => pg.IsMandatory).ToArray(); + var aliasDuplicates = ParameterGroups.SelectMany(pg => pg.Aliases) + //https://stackoverflow.com/a/18547390/294804 + .GroupBy(a => a).Where(g => g.Count() > 1).Select(g => g.Key).ToArray(); + if (aliasDuplicates.Any()) + { + throw new ParsingMetadataException($"The alias(es) [{String.Join(", ", aliasDuplicates)}] are defined on multiple parameters for cmdlet '{CmdletName}', which is not supported."); + } + ComplexInterfaceInfos = ParameterGroups.Where(pg => !pg.DontShow && pg.IsComplexInterface).OrderBy(pg => pg.ParameterName).Select(pg => pg.ComplexInterfaceInfo).ToArray(); + + Aliases = Variants.SelectMany(v => v.Attributes).ToAliasNames().ToArray(); + OutputTypes = Variants.SelectMany(v => v.Info.OutputType).Where(ot => ot.Type != null).GroupBy(ot => ot.Type).Select(otg => otg.First()).ToArray(); + SupportsShouldProcess = Variants.Any(v => v.SupportsShouldProcess); + SupportsPaging = Variants.Any(v => v.SupportsPaging); + DefaultParameterSetName = DetermineDefaultParameterSetName(); + HasMultipleVariants = Variants.Length > 1; + 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); + + CommentInfo = new CommentInfo(this); + } + + private string DetermineDefaultParameterSetName() + { + var defaultParameterSet = Variants + .Select(v => v.Metadata.DefaultParameterSetName) + .LastOrDefault(dpsn => dpsn.IsValidDefaultParameterSetName()); + + 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; + } + + return defaultParameterSet; + } + } + + internal class Variant + { + public string CmdletName { get; } + public string VariantName { get; } + public CommandInfo Info { get; } + public CommandMetadata Metadata { get; } + public PsHelpInfo HelpInfo { get; } + public bool HasParameterSets { get; } + public bool IsFunction { get; } + public string PrivateModuleName { get; } + public string PrivateCmdletName { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public Attribute[] Attributes { get; } + 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) + { + CmdletName = cmdletName; + VariantName = variantName; + Info = info; + HelpInfo = helpInfo ?? new PsHelpInfo(); + Metadata = metadata; + HasParameterSets = hasParameterSets; + IsFunction = Info.CommandType == CommandTypes.Function; + PrivateModuleName = Info.Source; + PrivateCmdletName = Metadata.Name; + SupportsShouldProcess = Metadata.SupportsShouldProcess; + SupportsPaging = Metadata.SupportsPaging; + + Attributes = this.ToAttributes(); + 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(); + } + } + + internal class ParameterGroup + { + public string ParameterName { get; } + public Parameter[] Parameters { get; } + + public string[] VariantNames { get; } + public string[] AllVariantNames { get; } + public bool HasAllVariants { get; } + public Type ParameterType { get; } + public string Description { get; } + + public string[] Aliases { get; } + public bool HasValidateNotNull { get; } + public bool HasAllowEmptyArray { get; } + public CompleterInfo CompleterInfo { get; } + public DefaultInfo DefaultInfo { get; } + public bool HasDefaultInfo { get; } + public ParameterCategory OrderCategory { get; } + public bool DontShow { get; } + public bool IsMandatory { get; } + public bool SupportsWildcards { get; } + public bool IsComplexInterface { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public InfoAttribute InfoAttribute { get; } + + public int? FirstPosition { get; } + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public bool IsInputType { get; } + + public ParameterGroup(string parameterName, Parameter[] parameters, string[] allVariantNames) + { + ParameterName = parameterName; + Parameters = parameters; + + VariantNames = Parameters.Select(p => p.VariantName).ToArray(); + AllVariantNames = allVariantNames; + HasAllVariants = VariantNames.Any(vn => vn == AllParameterSets) || !AllVariantNames.Except(VariantNames).Any(); + var types = Parameters.Select(p => p.ParameterType).Distinct().ToArray(); + if (types.Length > 1) + { + throw new ParsingMetadataException($"The parameter '{ParameterName}' has multiple parameter types [{String.Join(", ", types.Select(t => t.Name))}] defined, which is not supported."); + } + ParameterType = types.First(); + Description = Parameters.Select(p => p.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + + Aliases = Parameters.SelectMany(p => p.Attributes).ToAliasNames().ToArray(); + 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); + HasDefaultInfo = DefaultInfo != null && !String.IsNullOrEmpty(DefaultInfo.Script); + // When DefaultInfo is present, force all parameters from this group to be optional. + if (HasDefaultInfo) + { + foreach (var parameter in Parameters) + { + parameter.IsMandatory = false; + } + } + OrderCategory = Parameters.Select(p => p.OrderCategory).Distinct().DefaultIfEmpty(ParameterCategory.Body).Min(); + DontShow = Parameters.All(p => p.DontShow); + IsMandatory = HasAllVariants && Parameters.Any(p => p.IsMandatory); + SupportsWildcards = Parameters.Any(p => p.SupportsWildcards); + IsComplexInterface = Parameters.Any(p => p.IsComplexInterface); + ComplexInterfaceInfo = Parameters.Where(p => p.IsComplexInterface).Select(p => p.ComplexInterfaceInfo).FirstOrDefault(); + InfoAttribute = Parameters.Select(p => p.InfoAttribute).First(); + + FirstPosition = Parameters.Select(p => p.Position).FirstOrDefault(p => p != null); + ValueFromPipeline = Parameters.Any(p => p.ValueFromPipeline); + ValueFromPipelineByPropertyName = Parameters.Any(p => p.ValueFromPipelineByPropertyName); + IsInputType = ValueFromPipeline || ValueFromPipelineByPropertyName; + } + } + + internal class Parameter + { + public string VariantName { get; } + public string ParameterName { get; } + public ParameterMetadata Metadata { get; } + public PsParameterHelpInfo HelpInfo { get; } + public Type ParameterType { get; } + public Attribute[] Attributes { get; } + public ParameterCategory[] Categories { get; } + public ParameterCategory OrderCategory { get; } + public PSDefaultValueAttribute DefaultValueAttribute { get; } + public DefaultInfoAttribute DefaultInfoAttribute { get; } + public ParameterAttribute ParameterAttribute { get; } + public bool SupportsWildcards { get; } + public CompleterInfoAttribute CompleterInfoAttribute { get; } + public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + public PSArgumentCompleterAttribute PSArgumentCompleterAttribute { get; } + + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public int? Position { get; } + public bool DontShow { get; } + public bool IsMandatory { get; set; } + + public InfoAttribute InfoAttribute { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public bool IsComplexInterface { get; } + public string Description { get; } + + public Parameter(string variantName, string parameterName, ParameterMetadata metadata, PsParameterHelpInfo helpInfo = null) + { + VariantName = variantName; + ParameterName = parameterName; + Metadata = metadata; + HelpInfo = helpInfo ?? new PsParameterHelpInfo(); + + Attributes = Metadata.Attributes.ToArray(); + ParameterType = Attributes.OfType().FirstOrDefault()?.Type ?? Metadata.ParameterType; + Categories = Attributes.OfType().SelectMany(ca => ca.Categories).Distinct().ToArray(); + OrderCategory = Categories.DefaultIfEmpty(ParameterCategory.Body).Min(); + DefaultValueAttribute = Attributes.OfType().FirstOrDefault(); + DefaultInfoAttribute = Attributes.OfType().FirstOrDefault(); + ParameterAttribute = Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == VariantName || pa.ParameterSetName == AllParameterSets); + if (ParameterAttribute == null) + { + throw new ParsingMetadataException($"The variant '{VariantName}' has multiple parameter sets defined, which is not supported."); + } + SupportsWildcards = Attributes.OfType().Any(); + CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); + PSArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(attr => !attr.GetType().Equals(typeof(PSArgumentCompleterAttribute))); + + ValueFromPipeline = ParameterAttribute.ValueFromPipeline; + ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; + Position = ParameterAttribute.Position == Int32.MinValue ? (int?)null : ParameterAttribute.Position; + DontShow = ParameterAttribute.DontShow; + IsMandatory = ParameterAttribute.Mandatory; + + var complexParameterName = ParameterName.ToUpperInvariant(); + 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(); + // 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 + InfoAttribute.Description = String.IsNullOrEmpty(InfoAttribute.Description) ? description : InfoAttribute.Description; + ComplexInterfaceInfo = InfoAttribute.ToComplexInterfaceInfo(complexParameterName, ParameterType, true); + IsComplexInterface = ComplexInterfaceInfo.IsComplexInterface; + Description = $"{description}{(IsComplexInterface ? complexMessage : String.Empty)}"; + } + } + + internal class ComplexInterfaceInfo + { + public InfoAttribute InfoAttribute { get; } + + public string Name { get; } + public Type Type { get; } + public bool Required { get; } + public bool ReadOnly { get; } + public string Description { get; } + + public ComplexInterfaceInfo[] NestedInfos { get; } + public bool IsComplexInterface { get; } + + public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, bool? required, List seenTypes) + { + Name = name; + Type = type; + InfoAttribute = infoAttribute; + + Required = required ?? InfoAttribute.Required; + ReadOnly = InfoAttribute.ReadOnly; + Description = InfoAttribute.Description.ToPsSingleLine(); + + var unwrappedType = Type.Unwrap(); + var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; + (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[] { } : + unwrappedType.GetInterfaces() + .Concat(InfoAttribute.PossibleTypes) + .SelectMany(pt => pt.GetProperties() + .SelectMany(pi => pi.GetCustomAttributes(true).OfType() + .Select(ia => ia.ToComplexInterfaceInfo(pi.Name, pi.PropertyType, seenTypes: seenTypes)))) + .Where(cii => !cii.ReadOnly).OrderByDescending(cii => cii.Required).ToArray(); + // https://stackoverflow.com/a/503359/294804 + var associativeArrayInnerType = Type.GetInterfaces() + .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>)) + ?.GetTypeInfo().GetGenericArguments().First(); + if (!hasBeenSeen && associativeArrayInnerType != null) + { + var anyInfo = new InfoAttribute { Description = "This indicates any property can be added to this object." }; + NestedInfos = NestedInfos.Prepend(anyInfo.ToComplexInterfaceInfo("(Any)", associativeArrayInnerType)).ToArray(); + } + IsComplexInterface = NestedInfos.Any(); + } + } + + internal class CommentInfo + { + public string Description { get; } + public string Synopsis { get; } + + public string[] Examples { get; } + public string[] Inputs { get; } + public string[] Outputs { get; } + + public string OnlineVersion { get; } + public string[] RelatedLinks { get; } + public string[] ExternalUrls { get; } + + private const string HelpLinkPrefix = @"https://learn.microsoft.com/powershell/module/"; + + public CommentInfo(VariantGroup variantGroup) + { + var helpInfo = variantGroup.HelpInfo; + Description = variantGroup.Variants.SelectMany(v => v.Attributes).OfType().FirstOrDefault()?.Description.NullIfEmpty() + ?? helpInfo.Description.EmptyIfNull(); + Description = PsHelpInfo.CapitalizeFirstLetter(Description); + // If there is no Synopsis, PowerShell may put in the Syntax string as the Synopsis. This seems unintended, so we remove the Synopsis in this situation. + var synopsis = helpInfo.Synopsis.EmptyIfNull().Trim().StartsWith(variantGroup.CmdletName) ? String.Empty : helpInfo.Synopsis; + Synopsis = synopsis.NullIfEmpty() ?? Description; + + Examples = helpInfo.Examples.Select(rl => rl.Code).ToArray(); + + Inputs = (variantGroup.ParameterGroups.Where(pg => pg.IsInputType).Select(pg => pg.ParameterType.FullName).ToArray().NullIfEmpty() ?? + helpInfo.InputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(it => it.Name).ToArray()) + .Where(i => i != "None").Distinct().OrderBy(i => i).ToArray(); + Outputs = (variantGroup.OutputTypes.Select(ot => ot.Type.FullName).ToArray().NullIfEmpty() ?? + helpInfo.OutputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(ot => ot.Name).ToArray()) + .Where(o => o != "None").Distinct().OrderBy(o => o).ToArray(); + + // Use root module name in the help link + 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(); + } + } + + internal class CompleterInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public Type Type { get; } + public bool IsTypeCompleter { get; } + + public CompleterInfo(CompleterInfoAttribute infoAttribute) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + } + + public CompleterInfo(ArgumentCompleterAttribute completerAttribute) + { + Script = completerAttribute.ScriptBlock?.ToString(); + if (completerAttribute.Type != null) + { + Type = completerAttribute.Type; + IsTypeCompleter = true; + } + } + } + + 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) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + SetCondition = infoAttribute.SetCondition; + ParameterGroup = parameterGroup; + } + + public DefaultInfo(PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) + { + Description = defaultValueAttribute.Help; + ParameterGroup = parameterGroup; + if (defaultValueAttribute.Value != null) + { + Script = defaultValueAttribute.Value.ToString(); + } + } + } + + internal static class PsProxyTypeExtensions + { + public const string NoProfiles = "__NoProfiles"; + + public static bool IsValidDefaultParameterSetName(this string parameterSetName) => + !String.IsNullOrEmpty(parameterSetName) && parameterSetName != AllParameterSets; + + public static Variant[] ToVariants(this CommandInfo info, PsHelpInfo helpInfo) + { + var metadata = new CommandMetadata(info); + var privateCmdletName = metadata.Name.Split('!').First(); + var parts = privateCmdletName.Split('_'); + return parts.Length > 1 + ? new[] { new Variant(parts[0], parts[1], info, metadata, helpInfo: helpInfo) } + // Process multiple parameter sets, so we declare a variant per parameter set. + : info.ParameterSets.Select(ps => new Variant(privateCmdletName, ps.Name, info, metadata, true, helpInfo)).ToArray(); + } + + public static Variant[] ToVariants(this CmdletAndHelpInfo info) => info.CommandInfo.ToVariants(info.HelpInfo); + + public static Variant[] ToVariants(this CommandInfo info, PSObject helpInfo = null) => info.ToVariants(helpInfo?.ToPsHelpInfo()); + + public static Parameter[] ToParameters(this Variant variant) + { + var parameters = variant.Metadata.Parameters.AsEnumerable(); + var parameterHelp = variant.HelpInfo.Parameters.AsEnumerable(); + + if (variant.HasParameterSets) + { + parameters = parameters.Where(p => p.Value.ParameterSets.Keys.Any(k => k == variant.VariantName || k == AllParameterSets)); + 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 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."; + result = result.Append(new Parameter(variant.VariantName, "First", variant.Info.Parameters["First"], parameterHelp.FirstOrDefault(ph => ph.Name == "First"))); + result = result.Append(new Parameter(variant.VariantName, "Skip", variant.Info.Parameters["Skip"], parameterHelp.FirstOrDefault(ph => ph.Name == "Skip"))); + } + return result.ToArray(); + } + + public static Attribute[] ToAttributes(this Variant variant) => variant.IsFunction + ? ((FunctionInfo)variant.Info).ScriptBlock.Attributes.ToArray() + : variant.Metadata.CommandType.GetCustomAttributes(false).Cast().ToArray(); + + public static IEnumerable ToParameterGroups(this Variant[] variants) + { + var allVariantNames = variants.Select(vg => vg.VariantName).ToArray(); + return variants + .SelectMany(v => v.Parameters) + .GroupBy(p => p.ParameterName, StringComparer.InvariantCultureIgnoreCase) + .Select(pg => new ParameterGroup(pg.Key, pg.Select(p => p).ToArray(), allVariantNames)); + } + + public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute infoAttribute, string name, Type type, bool? required = null, List seenTypes = null) + => new ComplexInterfaceInfo(name, type, infoAttribute, required, seenTypes); + + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/PsAttributes.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/PsAttributes.cs new file mode 100644 index 00000000000..fb67fd05e49 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/PsAttributes.cs @@ -0,0 +1,136 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox +{ + [AttributeUsage(AttributeTargets.Class)] + public class DescriptionAttribute : Attribute + { + public string Description { get; } + + public DescriptionAttribute(string description) + { + Description = description; + } + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class ModelCmdletAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class InternalExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class GeneratedAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotFormatAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class ProfileAttribute : Attribute + { + public string[] Profiles { get; } + + public ProfileAttribute(params string[] profiles) + { + Profiles = profiles; + } + } + + [AttributeUsage(AttributeTargets.Class)] + public class HttpPathAttribute : Attribute + { + public string Path { get; set; } + public string ApiVersion { get; set; } + } + + [AttributeUsage(AttributeTargets.Class)] + public class NotSuggestDefaultParameterSetAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class CategoryAttribute : Attribute + { + public ParameterCategory[] Categories { get; } + + public CategoryAttribute(params ParameterCategory[] categories) + { + Categories = categories; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class ExportAsAttribute : Attribute + { + public Type Type { get; set; } + + public ExportAsAttribute(Type type) + { + Type = type; + } + } + + public enum ParameterCategory + { + // Note: Order is significant + Uri = 0, + Path, + Query, + Header, + Cookie, + Body, + Azure, + Runtime + } + + [AttributeUsage(AttributeTargets.Property)] + public class OriginAttribute : Attribute + { + public PropertyOrigin Origin { get; } + + public OriginAttribute(PropertyOrigin origin) + { + Origin = origin; + } + } + + public enum PropertyOrigin + { + // Note: Order is significant + Inherited = 0, + Owned, + Inlined + } + + [AttributeUsage(AttributeTargets.Property)] + public class ConstantAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Property)] + public class FormatTableAttribute : Attribute + { + public int Index { get; set; } = -1; + public bool HasIndex => Index != -1; + public string Label { get; set; } + public int Width { get; set; } = -1; + public bool HasWidth => Width != -1; + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/PsExtensions.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/PsExtensions.cs new file mode 100644 index 00000000000..b4bc5841d70 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/PsExtensions.cs @@ -0,0 +1,176 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.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 + // Note: This will unwrap nested collections, but we don't generate nested collections. + public static Type Unwrap(this Type type) + { + if (type.IsArray) + { + return type.GetElementType().Unwrap(); + } + + var typeInfo = type.GetTypeInfo(); + if (typeInfo.IsGenericType + && (typeInfo.GetGenericTypeDefinition() == typeof(Nullable<>) || typeof(IEnumerable<>).IsAssignableFrom(type))) + { + return typeInfo.GetGenericArguments().First().Unwrap(); + } + + return type; + } + + // https://stackoverflow.com/a/863944/294804 + private static bool IsSimple(this Type type) + { + var typeInfo = type.GetTypeInfo(); + return typeInfo.IsPrimitive + || typeInfo.IsEnum + || type == typeof(string) + || type == typeof(decimal); + } + + // https://stackoverflow.com/a/32025393/294804 + private static bool HasImplicitConversion(this Type baseType, Type targetType) => + baseType.GetMethods(BindingFlags.Public | BindingFlags.Static) + .Where(mi => mi.Name == "op_Implicit" && mi.ReturnType == targetType) + .Any(mi => mi.GetParameters().FirstOrDefault()?.ParameterType == baseType); + + public static bool IsPsSimple(this Type type) + { + var unwrappedType = type.Unwrap(); + return unwrappedType.IsSimple() + || unwrappedType == typeof(SwitchParameter) + || unwrappedType == typeof(Hashtable) + || unwrappedType == typeof(PSCredential) + || unwrappedType == typeof(ScriptBlock) + || unwrappedType == typeof(DateTime) + || unwrappedType == typeof(Uri) + || unwrappedType.HasImplicitConversion(typeof(string)); + } + + public static string ToPsList(this IEnumerable items) => String.Join(", ", items.Select(i => $"'{i}'")); + + public static IEnumerable ToAliasNames(this IEnumerable attributes) => attributes.OfType().SelectMany(aa => aa.AliasNames).Distinct(); + + public static bool IsArrayAndElementTypeIsT(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return itemType.IsArray && !tType.IsArray && tType.IsAssignableFrom(itemType.GetElementType()); + } + + public static bool IsTArrayAndElementTypeIsItem(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return !itemType.IsArray && tType.IsArray && (tType.GetElementType()?.IsAssignableFrom(itemType) ?? false); + } + + public static bool IsTypeOrArrayOfType(this object item) => item is T || item.IsArrayAndElementTypeIsT() || item.IsTArrayAndElementTypeIsItem(); + + public static T NormalizeArrayType(this object item) + { + if (item is T result) + { + return result; + } + + if (item.IsArrayAndElementTypeIsT()) + { + var array = (T[])Convert.ChangeType(item, typeof(T[])); + return array.FirstOrDefault(); + } + + if (item.IsTArrayAndElementTypeIsItem()) + { + var tType = typeof(T); + var array = Array.CreateInstance(tType.GetElementType(), 1); + array.SetValue(item, 0); + return (T)Convert.ChangeType(array, tType); + } + + return default(T); + } + + public static T GetNestedProperty(this PSObject psObject, params string[] names) => psObject.Properties.GetNestedProperty(names); + + public static T GetNestedProperty(this PSMemberInfoCollection properties, params string[] names) + { + var lastName = names.Last(); + var nestedProperties = names.Take(names.Length - 1).Aggregate(properties, (p, n) => p?.GetProperty(n)?.Properties); + return nestedProperties != null ? nestedProperties.GetProperty(lastName) : default(T); + } + + public static T GetProperty(this PSObject psObject, string name) => psObject.Properties.GetProperty(name); + + public static T GetProperty(this PSMemberInfoCollection properties, string name) + { + switch (properties[name]?.Value) + { + case PSObject psObject when psObject.BaseObject is PSCustomObject && psObject.ImmediateBaseObject.IsTypeOrArrayOfType(): + return psObject.ImmediateBaseObject.NormalizeArrayType(); + case PSObject psObject when psObject.BaseObject.IsTypeOrArrayOfType(): + return psObject.BaseObject.NormalizeArrayType(); + case object value when value.IsTypeOrArrayOfType(): + return value.NormalizeArrayType(); + default: + return default(T); + } + } + + public static IEnumerable RunScript(this PSCmdlet cmdlet, string script) + => PsHelpers.RunScript(cmdlet.InvokeCommand, script); + + public static void RunScript(this PSCmdlet cmdlet, string script) + => cmdlet.RunScript(script); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, string script) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, script); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, string script) + => engineIntrinsics.RunScript(script); + + public static IEnumerable RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => PsHelpers.RunScript(cmdlet.InvokeCommand, block.ToString()); + + public static void RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => cmdlet.RunScript(block.ToString()); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, block.ToString()); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => engineIntrinsics.RunScript(block.ToString()); + + /// + /// Returns if a parameter should be hidden by checking for . + /// + /// A PowerShell parameter. + public static bool IsHidden(this Parameter parameter) + { + return parameter.Attributes.Any(attr => attr is DoNotExportAttribute); + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/PsHelpers.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/PsHelpers.cs new file mode 100644 index 00000000000..be6ea303339 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/PsHelpers.cs @@ -0,0 +1,105 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using Pwsh = System.Management.Automation.PowerShell; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + internal static class PsHelpers + { + public static IEnumerable RunScript(string script) + => Pwsh.Create().AddScript(script).Invoke(); + + public static void RunScript(string script) + => RunScript(script); + + public static IEnumerable RunScript(CommandInvocationIntrinsics cii, string script) + => cii.InvokeScript(script).Select(o => o?.BaseObject).Where(o => o != null).OfType(); + + public static void RunScript(CommandInvocationIntrinsics cii, string script) + => RunScript(cii, script); + + public static IEnumerable GetModuleCmdlets(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletsCommand = String.Join(" + ", modulePaths.Select(mp => $"(Get-Command -Module (Import-Module '{mp}' -PassThru))")); + return (cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand)) + .Where(ci => ci.CommandType != CommandTypes.Alias); + } + + public static IEnumerable GetModuleCmdlets(params string[] modulePaths) + => GetModuleCmdlets(null, modulePaths); + + public static IEnumerable GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder) + { + // https://stackoverflow.com/a/40969712/294804 + var wrappedFolder = scriptFolder.Contains("'") ? $@"""{scriptFolder}""" : $@"'{scriptFolder}'"; + var getCmdletsCommand = $@" +$currentFunctions = Get-ChildItem function: +Get-ChildItem -Path {wrappedFolder} -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} +"; + return cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand); + } + + public static IEnumerable GetScriptCmdlets(string scriptFolder) + => GetScriptCmdlets(null, scriptFolder); + + public static IEnumerable GetScriptHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var importModules = String.Join(Environment.NewLine, modulePaths.Select(mp => $"Import-Module '{mp}'")); + var getHelpCommand = $@" +$currentFunctions = Get-ChildItem function: +{importModules} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} | ForEach-Object {{ Get-Help -Name $_.Name -Full }} +"; + return cmdlet?.RunScript(getHelpCommand) ?? RunScript(getHelpCommand); + } + + public static IEnumerable GetScriptHelpInfo(params string[] modulePaths) + => GetScriptHelpInfo(null, modulePaths); + + public static IEnumerable GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + 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)) + .Select(h => new CmdletAndHelpInfo { CommandInfo = (h["CommandInfo"] as PSObject)?.BaseObject as CommandInfo, HelpInfo = h["HelpInfo"] as PSObject }); + } + + public static IEnumerable GetModuleCmdletsAndHelpInfo(params string[] modulePaths) + => GetModuleCmdletsAndHelpInfo(null, modulePaths); + + public static CmdletAndHelpInfo ToCmdletAndHelpInfo(this CommandInfo commandInfo, PSObject helpInfo) => new CmdletAndHelpInfo { CommandInfo = commandInfo, HelpInfo = helpInfo }; + + public const string Psd1Indent = " "; + public const string GuidStart = Psd1Indent + "GUID"; + + public static Guid ReadGuidFromPsd1(string psd1Path) + { + var guid = Guid.NewGuid(); + if (File.Exists(psd1Path)) + { + var currentGuid = File.ReadAllLines(psd1Path) + .FirstOrDefault(l => l.TrimStart().StartsWith(GuidStart.TrimStart()))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) + .LastOrDefault()?.Replace("'", String.Empty); + guid = currentGuid != null ? Guid.Parse(currentGuid) : guid; + } + + return guid; + } + } + + internal class CmdletAndHelpInfo + { + public CommandInfo CommandInfo { get; set; } + public PSObject HelpInfo { get; set; } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/StringExtensions.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/StringExtensions.cs new file mode 100644 index 00000000000..32cf1366997 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/StringExtensions.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * 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.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + internal static class StringExtensions + { + public static string NullIfEmpty(this string text) => String.IsNullOrEmpty(text) ? null : text; + public static string NullIfWhiteSpace(this string text) => String.IsNullOrWhiteSpace(text) ? null : text; + public static string EmptyIfNull(this string text) => text ?? String.Empty; + + public static bool? ToNullableBool(this string text) => String.IsNullOrEmpty(text) ? (bool?)null : Convert.ToBoolean(text.ToLowerInvariant()); + + public static string ToUpperFirstCharacter(this string text) => String.IsNullOrEmpty(text) ? text : $"{text[0].ToString().ToUpperInvariant()}{text.Remove(0, 1)}"; + + public static string ReplaceNewLines(this string value, string replacer = " ", string[] newLineSymbols = null) + => (newLineSymbols ?? new []{ "\r\n", "\n" }).Aggregate(value.EmptyIfNull(), (current, symbol) => current.Replace(symbol, replacer)); + public static string NormalizeNewLines(this string value) => value.ReplaceNewLines("\u00A0").Replace("\u00A0", Environment.NewLine); + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/XmlExtensions.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/XmlExtensions.cs new file mode 100644 index 00000000000..8cfff81cad4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/BuildTime/XmlExtensions.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + internal static class XmlExtensions + { + public static string ToXmlString(this T inputObject, bool excludeDeclaration = false) + { + var serializer = new XmlSerializer(typeof(T)); + //https://stackoverflow.com/a/760290/294804 + //https://stackoverflow.com/a/3732234/294804 + var namespaces = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty }); + var xmlSettings = new XmlWriterSettings { OmitXmlDeclaration = excludeDeclaration, Indent = true }; + using (var stringWriter = new StringWriter()) + using (var xmlWriter = XmlWriter.Create(stringWriter, xmlSettings)) + { + serializer.Serialize(xmlWriter, inputObject, namespaces); + return stringWriter.ToString(); + } + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/CmdInfoHandler.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/CmdInfoHandler.cs new file mode 100644 index 00000000000..9288b06c769 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/CmdInfoHandler.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * 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.Management.Automation; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime +{ + using NextDelegate = Func, Task>, Task>; + using SignalDelegate = Func, Task>; + + public class CmdInfoHandler + { + private readonly string processRecordId; + private readonly string parameterSetName; + private readonly InvocationInfo invocationInfo; + + public CmdInfoHandler(string processRecordId, InvocationInfo invocationInfo, string parameterSetName) + { + this.processRecordId = processRecordId; + this.parameterSetName = parameterSetName; + this.invocationInfo = invocationInfo; + } + + public Task SendAsync(HttpRequestMessage request, CancellationToken token, Action cancel, SignalDelegate signal, NextDelegate next) + { + request.Headers.Add("x-ms-client-request-id", processRecordId); + request.Headers.Add("CommandName", invocationInfo?.InvocationName); + request.Headers.Add("FullCommandName", invocationInfo?.MyCommand?.Name); + request.Headers.Add("ParameterSetName", parameterSetName); + + // continue with pipeline. + return next(request, token, cancel, signal); + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Context.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Context.cs new file mode 100644 index 00000000000..6ac4432e7a5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/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.DataBox.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.DataBox.Runtime.Extensions; + + /// + /// The IContext Interface defines the communication mechanism for input customization. + /// + /// + /// In the context, we will have client, pipeline, PSBoundParameters, default EventListener, Cancellation. + /// + public interface IContext + { + System.Management.Automation.InvocationInfo InvocationInformation { get; set; } + System.Threading.CancellationTokenSource CancellationTokenSource { get; set; } + System.Collections.Generic.IDictionary ExtensibleParameters { get; } + HttpPipeline Pipeline { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.DataBox.DataBoxManagementClient Client { get; } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/ConversionException.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/ConversionException.cs new file mode 100644 index 00000000000..6f15d98e6aa --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/ConversionException.cs @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal class ConversionException : Exception + { + internal ConversionException(string message) + : base(message) { } + + internal ConversionException(JsonNode node, Type targetType) + : base($"Cannot convert '{node.Type}' to a {targetType.Name}") { } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/IJsonConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/IJsonConverter.cs new file mode 100644 index 00000000000..31aba744908 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/IJsonConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + internal interface IJsonConverter + { + JsonNode ToJson(object value); + + object FromJson(JsonNode node); + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/BinaryConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/BinaryConverter.cs new file mode 100644 index 00000000000..582e21dbec0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/BinaryConverter.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed class BinaryConverter : JsonConverter + { + internal override JsonNode ToJson(byte[] value) => new XBinary(value); + + internal override byte[] FromJson(JsonNode node) + { + switch (node.Type) + { + case JsonType.String : return Convert.FromBase64String(node.ToString()); // Base64 Encoded + case JsonType.Binary : return ((XBinary)node).Value; + } + + throw new ConversionException(node, typeof(byte[])); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/BooleanConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/BooleanConverter.cs new file mode 100644 index 00000000000..7c06a753035 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/BooleanConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class BooleanConverter : JsonConverter + { + internal override JsonNode ToJson(bool value) => new JsonBoolean(value); + + internal override bool FromJson(JsonNode node) => (bool)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DateTimeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DateTimeConverter.cs new file mode 100644 index 00000000000..00f8e9f1606 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DateTimeConverter.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed class DateTimeConverter : JsonConverter + { + internal override JsonNode ToJson(DateTime value) + { + return new JsonDate(value); + } + + internal override DateTime FromJson(JsonNode node) => (DateTime)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs new file mode 100644 index 00000000000..59cc24d4f8a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed class DateTimeOffsetConverter : JsonConverter + { + internal override JsonNode ToJson(DateTimeOffset value) => new JsonDate(value); + + internal override DateTimeOffset FromJson(JsonNode node) => (DateTimeOffset)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DecimalConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DecimalConverter.cs new file mode 100644 index 00000000000..1b2102d79c4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DecimalConverter.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class DecimalConverter : JsonConverter + { + internal override JsonNode ToJson(decimal value) => new JsonNumber(value.ToString()); + + internal override decimal FromJson(JsonNode node) + { + return (decimal)node; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DoubleConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DoubleConverter.cs new file mode 100644 index 00000000000..cb0e0125197 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/DoubleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class DoubleConverter : JsonConverter + { + internal override JsonNode ToJson(double value) => new JsonNumber(value); + + internal override double FromJson(JsonNode node) => (double)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/EnumConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/EnumConverter.cs new file mode 100644 index 00000000000..b79571e8067 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/EnumConverter.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. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed class EnumConverter : IJsonConverter + { + private readonly Type type; + + internal EnumConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + } + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + + public object FromJson(JsonNode node) + { + if (node.Type == JsonType.Number) + { + return Enum.ToObject(type, (int)node); + } + + return Enum.Parse(type, node.ToString(), ignoreCase: true); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/GuidConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/GuidConverter.cs new file mode 100644 index 00000000000..47f262b54b1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/GuidConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed class GuidConverter : JsonConverter + { + internal override JsonNode ToJson(Guid value) => new JsonString(value.ToString()); + + internal override Guid FromJson(JsonNode node) => (Guid)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/HashSet'1Converter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/HashSet'1Converter.cs new file mode 100644 index 00000000000..1cc97a4b67f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/HashSet'1Converter.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed class HashSetConverter : JsonConverter> + { + internal override JsonNode ToJson(HashSet value) + { + return new XSet(value); + } + + internal override HashSet FromJson(JsonNode node) + { + var collection = node as ICollection; + + if (collection.Count == 0) return null; + + // TODO: Remove Linq depedency + return new HashSet(collection.Cast()); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/Int16Converter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/Int16Converter.cs new file mode 100644 index 00000000000..4be2ac00586 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/Int16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class Int16Converter : JsonConverter + { + internal override JsonNode ToJson(short value) => new JsonNumber(value); + + internal override short FromJson(JsonNode node) => (short)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/Int32Converter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/Int32Converter.cs new file mode 100644 index 00000000000..739c6da268c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/Int32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class Int32Converter : JsonConverter + { + internal override JsonNode ToJson(int value) => new JsonNumber(value); + + internal override int FromJson(JsonNode node) => (int)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/Int64Converter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/Int64Converter.cs new file mode 100644 index 00000000000..b175af60ffe --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/Int64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class Int64Converter : JsonConverter + { + internal override JsonNode ToJson(long value) => new JsonNumber(value); + + internal override long FromJson(JsonNode node) => (long)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/JsonArrayConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/JsonArrayConverter.cs new file mode 100644 index 00000000000..3fb424ca965 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/JsonArrayConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class JsonArrayConverter : JsonConverter + { + internal override JsonNode ToJson(JsonArray value) => value; + + internal override JsonArray FromJson(JsonNode node) => (JsonArray)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/JsonObjectConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/JsonObjectConverter.cs new file mode 100644 index 00000000000..ff0501a7371 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/JsonObjectConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class JsonObjectConverter : JsonConverter + { + internal override JsonNode ToJson(JsonObject value) => value; + + internal override JsonObject FromJson(JsonNode node) => (JsonObject)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/SingleConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/SingleConverter.cs new file mode 100644 index 00000000000..75506ccb7c3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/SingleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class SingleConverter : JsonConverter + { + internal override JsonNode ToJson(float value) => new JsonNumber(value.ToString()); + + internal override float FromJson(JsonNode node) => (float)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/StringConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/StringConverter.cs new file mode 100644 index 00000000000..5db51232442 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/StringConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class StringConverter : JsonConverter + { + internal override JsonNode ToJson(string value) => new JsonString(value); + + internal override string FromJson(JsonNode node) => node.ToString(); + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/TimeSpanConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/TimeSpanConverter.cs new file mode 100644 index 00000000000..be2e69c427f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/TimeSpanConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed class TimeSpanConverter : JsonConverter + { + internal override JsonNode ToJson(TimeSpan value) => new JsonString(value.ToString()); + + internal override TimeSpan FromJson(JsonNode node) => (TimeSpan)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UInt16Converter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UInt16Converter.cs new file mode 100644 index 00000000000..72c3fcccef4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UInt16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class UInt16Converter : JsonConverter + { + internal override JsonNode ToJson(ushort value) => new JsonNumber(value); + + internal override ushort FromJson(JsonNode node) => (ushort)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UInt32Converter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UInt32Converter.cs new file mode 100644 index 00000000000..0be51c0f0b7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UInt32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class UInt32Converter : JsonConverter + { + internal override JsonNode ToJson(uint value) => new JsonNumber(value); + + internal override uint FromJson(JsonNode node) => (uint)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UInt64Converter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UInt64Converter.cs new file mode 100644 index 00000000000..16bfb7c2520 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UInt64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class UInt64Converter : JsonConverter + { + internal override JsonNode ToJson(ulong value) => new JsonNumber(value.ToString()); + + internal override ulong FromJson(JsonNode node) => (ulong)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UriConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UriConverter.cs new file mode 100644 index 00000000000..6ea22568eb3 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/Instances/UriConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed class UriConverter : JsonConverter + { + internal override JsonNode ToJson(Uri value) => new JsonString(value.AbsoluteUri); + + internal override Uri FromJson(JsonNode node) => (Uri)node; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/JsonConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/JsonConverter.cs new file mode 100644 index 00000000000..abd764720d0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/JsonConverter.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public abstract class JsonConverter : IJsonConverter + { + internal abstract T FromJson(JsonNode node); + + internal abstract JsonNode ToJson(T value); + + #region IConverter + + object IJsonConverter.FromJson(JsonNode node) => FromJson(node); + + JsonNode IJsonConverter.ToJson(object value) => ToJson((T)value); + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/JsonConverterAttribute.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/JsonConverterAttribute.cs new file mode 100644 index 00000000000..5407ea076fd --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/JsonConverterAttribute.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed class JsonConverterAttribute : Attribute + { + internal JsonConverterAttribute(Type type) + { + Converter = (IJsonConverter)Activator.CreateInstance(type); + } + + internal IJsonConverter Converter { get; } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/JsonConverterFactory.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/JsonConverterFactory.cs new file mode 100644 index 00000000000..2cd7c106ab0 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/JsonConverterFactory.cs @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public sealed class JsonConverterFactory + { + private static readonly Dictionary converters = new Dictionary(); + + static JsonConverterFactory() + { + AddInternal(new BooleanConverter()); + AddInternal(new DateTimeConverter()); + AddInternal(new DateTimeOffsetConverter()); + AddInternal(new BinaryConverter()); + AddInternal(new DecimalConverter()); + AddInternal(new DoubleConverter()); + AddInternal(new GuidConverter()); + AddInternal(new Int16Converter()); + AddInternal(new Int32Converter()); + AddInternal(new Int64Converter()); + AddInternal(new SingleConverter()); + AddInternal(new StringConverter()); + AddInternal(new TimeSpanConverter()); + AddInternal(new UInt16Converter()); + AddInternal(new UInt32Converter()); + AddInternal(new UInt64Converter()); + AddInternal(new UriConverter()); + + // Hash sets + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + + // JSON + + AddInternal(new JsonObjectConverter()); + AddInternal(new JsonArrayConverter()); + } + + internal static Dictionary Instances => converters; + + internal static IJsonConverter Get(Type type) + { + var details = TypeDetails.Get(type); + + if (details.JsonConverter == null) + { + throw new ConversionException($"No converter found for '{type.Name}'."); + } + + return details.JsonConverter; + } + + internal static bool TryGet(Type type, out IJsonConverter converter) + { + var typeDetails = TypeDetails.Get(type); + + converter = typeDetails.JsonConverter; + + return converter != null; + } + + private static void AddInternal(JsonConverter converter) + => converters.Add(typeof(T), converter); + + private static void AddInternal(IJsonConverter converter) + => converters.Add(typeof(T), converter); + + internal static void Add(JsonConverter converter) + { + if (converter == null) + { + throw new ArgumentNullException(nameof(converter)); + } + + AddInternal(converter); + + var type = TypeDetails.Get(); + + type.JsonConverter = converter; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/StringLikeConverter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/StringLikeConverter.cs new file mode 100644 index 00000000000..3d0a819e0c5 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Conversions/StringLikeConverter.cs @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * 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.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed class StringLikeConverter : IJsonConverter + { + private readonly Type type; + private readonly MethodInfo parseMethod; + + internal StringLikeConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + this.parseMethod = StringLikeHelper.GetParseMethod(type); + } + + public object FromJson(JsonNode node) => + parseMethod.Invoke(null, new[] { node.ToString() }); + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + } + + internal static class StringLikeHelper + { + private static readonly Type[] parseMethodParamaterTypes = new[] { typeof(string) }; + + internal static bool IsStringLike(Type type) + { + return GetParseMethod(type) != null; + } + + internal static MethodInfo GetParseMethod(Type type) + { + MethodInfo method = type.GetMethod("Parse", parseMethodParamaterTypes); + + if (method?.IsPublic != true) return null; + + return method; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/IJsonSerializable.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/IJsonSerializable.cs new file mode 100644 index 00000000000..43d1e674e75 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/IJsonSerializable.cs @@ -0,0 +1,263 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json; +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime +{ + public interface IJsonSerializable + { + JsonNode ToJson(JsonObject container = null, SerializationMode serializationMode = SerializationMode.None); + } + internal static class JsonSerializable + { + /// + /// Serializes an enumerable and returns a JsonNode. + /// + /// an IEnumerable collection of items + /// A JsonNode that contains the collection of items serialized. + private static JsonNode ToJsonValue(System.Collections.IEnumerable enumerable) + { + if (enumerable != null) + { + // is it a byte array of some kind? + if (enumerable is System.Collections.Generic.IEnumerable byteEnumerable) + { + return new XBinary(System.Linq.Enumerable.ToArray(byteEnumerable)); + } + + var hasValues = false; + // just create an array of value nodes. + var result = new XNodeArray(); + foreach (var each in enumerable) + { + // we had at least one value. + hasValues = true; + + // try to serialize it. + var node = ToJsonValue(each); + if (null != node) + { + result.Add(node); + } + } + + // if we were able to add values, (or it was just empty), return it. + if (result.Count > 0 || !hasValues) + { + return result; + } + } + + // we couldn't serialize the values. Sorry. + return null; + } + + /// + /// Serializes a valuetype to a JsonNode. + /// + /// a ValueType (ie, a primitive, enum or struct) to be serialized + /// a JsonNode with the serialized value + private static JsonNode ToJsonValue(ValueType vValue) + { + // numeric type + if (vValue is SByte || vValue is Int16 || vValue is Int32 || vValue is Int64 || vValue is Byte || vValue is UInt16 || vValue is UInt32 || vValue is UInt64 || vValue is decimal || vValue is float || vValue is double) + { + return new JsonNumber(vValue.ToString()); + } + + // boolean type + if (vValue is bool bValue) + { + return new JsonBoolean(bValue); + } + + // dates + if (vValue is DateTime dtValue) + { + return new JsonDate(dtValue); + } + + // DictionaryEntity struct type + if (vValue is System.Collections.DictionaryEntry deValue) + { + return new JsonObject { { deValue.Key.ToString(), ToJsonValue(deValue.Value) } }; + } + + // sorry, no idea. + return null; + } + /// + /// Attempts to serialize an object by using ToJson() or ToJsonString() if they exist. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + private static JsonNode TryToJsonValue(dynamic oValue) + { + object jsonValue = null; + dynamic v = oValue; + try + { + jsonValue = v.ToJson().ToString(); + } + catch + { + // no harm... + try + { + jsonValue = v.ToJsonString().ToString(); + } + catch + { + // no worries here either. + } + } + + // if we got something out, let's use it. + if (null != jsonValue) + { + // JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok? + return new JsonNumber(jsonValue.ToString()); + } + + return null; + } + + /// + /// Serialize an object by using a variety of methods. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + internal static JsonNode ToJsonValue(object value) + { + // things that implement our interface are preferred. + if (value is Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IJsonSerializable jsonSerializable) + { + return jsonSerializable.ToJson(); + } + + // strings are easy. + if (value is string || value is char) + { + return new JsonString(value.ToString()); + } + + // value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString ) + if (value is System.ValueType vValue) + { + return ToJsonValue(vValue) ?? TryToJsonValue(vValue) ?? new JsonString(vValue.ToString()); + } + + // dictionaries are objects that should be able to serialize + if (value is System.Collections.Generic.IDictionary dictionary) + { + return Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.ToJson(dictionary, null); + } + + // hashtables are converted to dictionaries for serialization + if (value is System.Collections.Hashtable hashtable) + { + var dict = new System.Collections.Generic.Dictionary(); + DictionaryExtensions.HashTableToDictionary(hashtable, dict); + return Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.ToJson(dict, null); + } + + // enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString) + if (value is System.Collections.IEnumerable enumerableValue) + { + // some kind of enumerable value + return ToJsonValue(enumerableValue) ?? TryToJsonValue(value) ?? new JsonString(value.ToString()); + } + + // at this point, we're going to fallback to a string literal here, since we really have no idea what it is. + return new JsonString(value.ToString()); + } + + internal static JsonObject ToJson(System.Collections.Generic.Dictionary dictionary, JsonObject container) => ToJson((System.Collections.Generic.IDictionary)dictionary, container); + + /// + /// Serializes a dictionary into a JsonObject container. + /// + /// The dictionary to serailize + /// the container to serialize the dictionary into + /// the container + internal static JsonObject ToJson(System.Collections.Generic.IDictionary dictionary, JsonObject container) + { + container = container ?? new JsonObject(); + if (dictionary != null && dictionary.Count > 0) + { + foreach (var key in dictionary) + { + // currently, we don't serialize null values. + if (null != key.Value) + { + container.Add(key.Key, ToJsonValue(key.Value)); + continue; + } + } + } + return container; + } + + internal static Func> DeserializeDictionary(Func> dictionaryFactory) + { + return (node) => FromJson(node, dictionaryFactory(), (object)(DeserializeDictionary(dictionaryFactory)) as Func); + } + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.Dictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) => FromJson(json, (System.Collections.Generic.IDictionary)container, objectFactory, excludes); + + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.IDictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) + { + if (null == json) + { + return container; + } + + foreach (var key in json.Keys) + { + if (true == excludes?.Contains(key)) + { + continue; + } + + var value = json[key]; + try + { + switch (value.Type) + { + case JsonType.Null: + // skip null values. + continue; + + case JsonType.Array: + case JsonType.Boolean: + case JsonType.Date: + case JsonType.Binary: + case JsonType.Number: + case JsonType.String: + container.Add(key, (V)value.ToValue()); + break; + case JsonType.Object: + if (objectFactory != null) + { + var v = objectFactory(value as JsonObject); + if (null != v) + { + container.Add(key, v); + } + } + break; + } + } + catch + { + } + } + return container; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonArray.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonArray.cs new file mode 100644 index 00000000000..1b42e336026 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonArray.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + public partial class JsonArray + { + internal override object ToValue() => Count == 0 ? new object[0] : System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Select(this, each => each.ToValue())); + } + + +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonBoolean.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonBoolean.cs new file mode 100644 index 00000000000..2c63c567acc --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonBoolean.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + internal partial class JsonBoolean + { + internal static JsonBoolean Create(bool? value) => value is bool b ? new JsonBoolean(b) : null; + internal bool ToBoolean() => Value; + + internal override object ToValue() => Value; + } + + +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonNode.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonNode.cs new file mode 100644 index 00000000000..9e5a927767e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonNode.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonNode + { + /// + /// Returns the content of this node as the underlying value. + /// Will default to the string representation if not overridden in child classes. + /// + /// an object with the underlying value of the node. + internal virtual object ToValue() { + return this.ToString(); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonNumber.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonNumber.cs new file mode 100644 index 00000000000..1be010a2833 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonNumber.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + using System; + + public partial class JsonNumber + { + internal static readonly DateTime EpochDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + private static long ToUnixTime(DateTime dateTime) + { + return (long)dateTime.Subtract(EpochDate).TotalSeconds; + } + private static DateTime FromUnixTime(long totalSeconds) + { + return EpochDate.AddSeconds(totalSeconds); + } + internal byte ToByte() => this; + internal int ToInt() => this; + internal long ToLong() => this; + internal short ToShort() => this; + internal UInt16 ToUInt16() => this; + internal UInt32 ToUInt32() => this; + internal UInt64 ToUInt64() => this; + internal decimal ToDecimal() => this; + internal double ToDouble() => this; + internal float ToFloat() => this; + + internal static JsonNumber Create(int? value) => value is int n ? new JsonNumber(n) : null; + internal static JsonNumber Create(long? value) => value is long n ? new JsonNumber(n) : null; + internal static JsonNumber Create(float? value) => value is float n ? new JsonNumber(n) : null; + internal static JsonNumber Create(double? value) => value is double n ? new JsonNumber(n) : null; + internal static JsonNumber Create(decimal? value) => value is decimal n ? new JsonNumber(n) : null; + internal static JsonNumber Create(DateTime? value) => value is DateTime date ? new JsonNumber(ToUnixTime(date)) : null; + + public static implicit operator DateTime(JsonNumber number) => FromUnixTime(number); + internal DateTime ToDateTime() => this; + + internal JsonNumber(decimal value) + { + this.value = value.ToString(); + } + internal override object ToValue() + { + if (IsInteger) + { + if (int.TryParse(this.value, out int iValue)) + { + return iValue; + } + if (long.TryParse(this.value, out long lValue)) + { + return lValue; + } + } + else + { + if (float.TryParse(this.value, out float fValue)) + { + return fValue; + } + if (double.TryParse(this.value, out double dValue)) + { + return dValue; + } + if (decimal.TryParse(this.value, out decimal dcValue)) + { + return dcValue; + } + } + return null; + } + } + + +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonObject.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonObject.cs new file mode 100644 index 00000000000..c0ba9d30617 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonObject.cs @@ -0,0 +1,183 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonObject + { + internal override object ToValue() => Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.JsonSerializable.FromJson(this, new System.Collections.Generic.Dictionary(), (obj) => obj.ToValue()); + + internal void SafeAdd(string name, Func valueFn) + { + if (valueFn != null) + { + var value = valueFn(); + if (null != value) + { + items.Add(name, value); + } + } + } + + internal void SafeAdd(string name, JsonNode value) + { + if (null != value) + { + items.Add(name, value); + } + } + + internal T NullableProperty(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; + } + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + //throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal JsonObject Property(string propertyName) + { + return PropertyT(propertyName); + } + + internal T PropertyT(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; // we're going to assume that the consumer knows what to do if null is explicity returned? + } + + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + // throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal int NumberProperty(string propertyName, ref int output) => output = this.PropertyT(propertyName)?.ToInt() ?? output; + internal float NumberProperty(string propertyName, ref float output) => output = this.PropertyT(propertyName)?.ToFloat() ?? output; + internal byte NumberProperty(string propertyName, ref byte output) => output = this.PropertyT(propertyName)?.ToByte() ?? output; + internal long NumberProperty(string propertyName, ref long output) => output = this.PropertyT(propertyName)?.ToLong() ?? output; + internal double NumberProperty(string propertyName, ref double output) => output = this.PropertyT(propertyName)?.ToDouble() ?? output; + internal decimal NumberProperty(string propertyName, ref decimal output) => output = this.PropertyT(propertyName)?.ToDecimal() ?? output; + internal short NumberProperty(string propertyName, ref short output) => output = this.PropertyT(propertyName)?.ToShort() ?? output; + internal DateTime NumberProperty(string propertyName, ref DateTime output) => output = this.PropertyT(propertyName)?.ToDateTime() ?? output; + + internal int? NumberProperty(string propertyName, ref int? output) => output = this.NullableProperty(propertyName)?.ToInt() ?? null; + internal float? NumberProperty(string propertyName, ref float? output) => output = this.NullableProperty(propertyName)?.ToFloat() ?? null; + internal byte? NumberProperty(string propertyName, ref byte? output) => output = this.NullableProperty(propertyName)?.ToByte() ?? null; + internal long? NumberProperty(string propertyName, ref long? output) => output = this.NullableProperty(propertyName)?.ToLong() ?? null; + internal double? NumberProperty(string propertyName, ref double? output) => output = this.NullableProperty(propertyName)?.ToDouble() ?? null; + internal decimal? NumberProperty(string propertyName, ref decimal? output) => output = this.NullableProperty(propertyName)?.ToDecimal() ?? null; + internal short? NumberProperty(string propertyName, ref short? output) => output = this.NullableProperty(propertyName)?.ToShort() ?? null; + + internal DateTime? NumberProperty(string propertyName, ref DateTime? output) => output = this.NullableProperty(propertyName)?.ToDateTime() ?? null; + + + internal string StringProperty(string propertyName) => this.PropertyT(propertyName)?.ToString(); + internal string StringProperty(string propertyName, ref string output) => output = this.PropertyT(propertyName)?.ToString() ?? output; + internal char StringProperty(string propertyName, ref char output) => output = this.PropertyT(propertyName)?.ToChar() ?? output; + internal char? StringProperty(string propertyName, ref char? output) => output = this.PropertyT(propertyName)?.ToChar() ?? null; + + internal DateTime StringProperty(string propertyName, ref DateTime output) => DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out output) ? output : output; + internal DateTime? StringProperty(string propertyName, ref DateTime? output) => output = DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out var o) ? o : output; + + + internal bool BooleanProperty(string propertyName, ref bool output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? output; + internal bool? BooleanProperty(string propertyName, ref bool? output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? null; + + internal T[] ArrayProperty(string propertyName, ref T[] output, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + } + return output; + } + internal T[] ArrayProperty(string propertyName, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + var output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + return output; + } + return new T[0]; + } + internal void IterateArrayProperty(string propertyName, Action deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + for (var i = 0; i < array.Count; i++) + { + deserializer(array[i]); + } + } + } + + internal Dictionary DictionaryProperty(string propertyName, ref Dictionary output, Func deserializer) + { + var dictionary = this.PropertyT(propertyName); + if (output == null) + { + output = new Dictionary(); + } + else + { + output.Clear(); + } + if (dictionary != null) + { + foreach (var key in dictionary.Keys) + { + output[key] = deserializer(dictionary[key]); + } + } + return output; + } + + internal static JsonObject Create(IDictionary source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new JsonObject(); + + foreach (var key in source.Keys) + { + result.SafeAdd(key, selector(source[key])); + } + return result; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonString.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonString.cs new file mode 100644 index 00000000000..b674eab737f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/JsonString.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + using System; + using System.Globalization; + using System.Linq; + + public partial class JsonString + { + internal static string DateFormat = "yyyy-MM-dd"; + internal static string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; + internal static string DateTimeRfc1123Format = "R"; + + internal static JsonString Create(string value) => value == null ? null : new JsonString(value); + internal static JsonString Create(char? value) => value is char c ? new JsonString(c.ToString()) : null; + + internal static JsonString CreateDate(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTime(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTimeRfc1123(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeRfc1123Format, CultureInfo.CurrentCulture)) : null; + + internal char ToChar() => this.Value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char(JsonString value) => value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char? (JsonString value) => value?.ToString()?.FirstOrDefault(); + + public static implicit operator DateTime(JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime); + public static implicit operator DateTime? (JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime?); + + } + + +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/XNodeArray.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/XNodeArray.cs new file mode 100644 index 00000000000..d9e786facba --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Customizations/XNodeArray.cs @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + using System; + using System.Linq; + + public partial class XNodeArray + { + internal static XNodeArray Create(T[] source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new XNodeArray(); + foreach (var item in source.Select(selector)) + { + result.SafeAdd(item); + } + return result; + } + internal void SafeAdd(JsonNode item) + { + if (item != null) + { + items.Add(item); + } + } + internal void SafeAdd(Func itemFn) + { + if (itemFn != null) + { + var item = itemFn(); + if (item != null) + { + items.Add(item); + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Debugging.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Debugging.cs new file mode 100644 index 00000000000..0cc7a3290b6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Debugging.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + internal static class AttachDebugger + { + internal static void Break() + { + while (!System.Diagnostics.Debugger.IsAttached) + { + System.Console.Error.WriteLine($"Waiting for debugger to attach to process {System.Diagnostics.Process.GetCurrentProcess().Id}"); + for (int i = 0; i < 50; i++) + { + if (System.Diagnostics.Debugger.IsAttached) + { + break; + } + System.Threading.Thread.Sleep(100); + System.Console.Error.Write("."); + } + System.Console.Error.WriteLine(); + } + System.Diagnostics.Debugger.Break(); + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/DictionaryExtensions.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/DictionaryExtensions.cs new file mode 100644 index 00000000000..213d73ffc70 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/DictionaryExtensions.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.DataBox.Runtime +{ + internal static class DictionaryExtensions + { + internal static void HashTableToDictionary(System.Collections.Hashtable hashtable, System.Collections.Generic.IDictionary dictionary) + { + if (null == hashtable) + { + return; + } + foreach (var each in hashtable.Keys) + { + var key = each.ToString(); + var value = hashtable[key]; + if (null != value) + { + try + { + dictionary[key] = (V)value; + } + catch + { + // Values getting dropped; not compatible with target dictionary. Not sure what to do here. + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventData.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventData.cs new file mode 100644 index 00000000000..c29efb47224 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventData.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + + using System; + using System.Threading; + + ///Represents the data in signaled event. + public partial class EventData + { + /// + /// The type of the event being signaled + /// + public string Id; + + /// + /// The user-ready message from the event. + /// + public string Message; + + /// + /// When the event is about a parameter, this is the parameter name. + /// Used in Validation Events + /// + public string Parameter; + + /// + /// This represents a numeric value associated with the event. + /// Use for progress-style events + /// + public double Value; + + /// + /// Any extended data for an event should be serialized and stored here. + /// + public string ExtendedData; + + /// + /// If the event triggers after the request message has been created, this will contain the Request Message (which in HTTP calls would be HttpRequestMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.RequestMessgae is HttpRequestMessage httpRequest) + /// { + /// httpRequest.Headers.Add("x-request-flavor", "vanilla"); + /// } + /// + /// + public object RequestMessage; + + /// + /// If the event triggers after the response is back, this will contain the Response Message (which in HTTP calls would be HttpResponseMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.ResponseMessage is HttpResponseMessage httpResponse){ + /// var flavor = httpResponse.Headers.GetValue("x-request-flavor"); + /// } + /// + /// + public object ResponseMessage; + + /// + /// Cancellation method for this event. + /// + /// If the event consumer wishes to cancel the request that initiated this event, call Cancel() + /// + /// + /// The original initiator of the request must provide the implementation of this. + /// + public System.Action Cancel; + } + +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventDataExtensions.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventDataExtensions.cs new file mode 100644 index 00000000000..f1f7906750c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventDataExtensions.cs @@ -0,0 +1,94 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + using System; + + /// + /// PowerShell-specific data on top of the llc# EventData + /// + /// + /// In PowerShell, we add on the EventDataConverter to support sending events between modules. + /// Obviously, this code would need to be duplcated on both modules. + /// This is preferable to sharing a common library, as versioning makes that problematic. + /// + [System.ComponentModel.TypeConverter(typeof(EventDataConverter))] + public partial class EventData : EventArgs + { + } + + /// + /// A PowerShell PSTypeConverter to adapt an EventData object that has been passed. + /// Usually used between modules. + /// + public class EventDataConverter : System.Management.Automation.PSTypeConverter + { + public override bool CanConvertTo(object sourceValue, Type destinationType) => false; + public override object ConvertTo(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => null; + public override bool CanConvertFrom(dynamic sourceValue, Type destinationType) => destinationType == typeof(EventData) && CanConvertFrom(sourceValue); + public override object ConvertFrom(dynamic sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Verifies that a given object has the required members to convert it to the target type (EventData) + /// + /// Uses a dynamic type so that it is able to use the simplest code without excessive checking. + /// + /// The instance to verify + /// True, if the object has all the required parameters. + public static bool CanConvertFrom(dynamic sourceValue) + { + try + { + // check if this has *required* parameters... + sourceValue?.Id?.GetType(); + sourceValue?.Message?.GetType(); + sourceValue?.Cancel?.GetType(); + + // remaining parameters are not *required*, + // and if they have values, it will copy them at conversion time. + } + catch + { + // if anything throws an exception (because it's null, or doesn't have that member) + return false; + } + return true; + } + + /// + /// Returns result of the delegate as the expected type, or default(T) + /// + /// This isolates any exceptions from the consumer. + /// + /// A delegate that returns a value + /// The desired output type + /// The value from the function if the type is correct + private static T To(Func srcValue) + { + try { return srcValue(); } + catch { return default(T); } + } + + /// + /// Converts an incoming object to the expected type by treating the incoming object as a dynamic, and coping the expected values. + /// + /// the incoming object + /// EventData + public static EventData ConvertFrom(dynamic sourceValue) + { + return new EventData + { + Id = To(() => sourceValue.Id), + Message = To(() => sourceValue.Message), + Parameter = To(() => sourceValue.Parameter), + Value = To(() => sourceValue.Value), + RequestMessage = To(() => sourceValue.RequestMessage), + ResponseMessage = To(() => sourceValue.ResponseMessage), + Cancel = To(() => sourceValue.Cancel) + }; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventListener.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventListener.cs new file mode 100644 index 00000000000..eae14fe4b10 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventListener.cs @@ -0,0 +1,247 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.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.DataBox.Runtime.Extensions; + + public interface IValidates + { + Task Validate(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IEventListener listener); + } + + /// + /// The IEventListener Interface defines the communication mechanism for Signaling events during a remote call. + /// + /// + /// The interface is designed to be as minimal as possible, allow for quick peeking of the event type (id) + /// and the cancellation status and provides a delegate for retrieving the event details themselves. + /// + public interface IEventListener + { + Task Signal(string id, CancellationToken token, GetEventData createMessage); + CancellationToken Token { get; } + System.Action Cancel { get; } + } + + internal static partial class Extensions + { + public static Task Signal(this IEventListener instance, string id, CancellationToken token, Func createMessage) => instance.Signal(id, token, createMessage); + public static Task Signal(this IEventListener instance, string id, CancellationToken token) => instance.Signal(id, token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, EventData message) => instance.Signal(id, token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, Func createMessage) => instance.Signal(id, instance.Token, createMessage); + public static Task Signal(this IEventListener instance, string id) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, EventData message) => instance.Signal(id, instance.Token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, System.Uri uri) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = uri.ToString(), Cancel = instance.Cancel }); + + public static async Task AssertNotNull(this IEventListener instance, string parameterName, object value) + { + if (value == null) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' should not be null", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMinimumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length < length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is less than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMaximumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length > length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is greater than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + + public static async Task AssertRegEx(this IEventListener instance, string parameterName, string value, string regularExpression) + { + if (value != null && !System.Text.RegularExpressions.Regex.Match(value, regularExpression).Success) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' does not validate against pattern /{regularExpression}/", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertEnum(this IEventListener instance, string parameterName, string value, params string[] values) + { + if (!values.Any(each => each.Equals(value))) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' is not one of ({values.Aggregate((c, e) => $"'{e}',{c}")}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertObjectIsValid(this IEventListener instance, string parameterName, object inst) + { + await (inst as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.IValidates)?.Validate(instance); + } + + public static async Task AssertIsLessThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) >= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) <= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsLessThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) > 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) < 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, Int64? value, Int64 multiple) + { + if (null != value && value % multiple != 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, double? value, double multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, decimal? value, decimal multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + } + + /// + /// An Implementation of the IEventListener that supports subscribing to events and dispatching them + /// (used for manually using the lowlevel interface) + /// + public class EventListener : CancellationTokenSource, IEnumerable>, IEventListener + { + private Dictionary calls = new Dictionary(); + public IEnumerator> GetEnumerator() => calls.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => calls.GetEnumerator(); + public EventListener() + { + } + + public new Action Cancel => base.Cancel; + private Event tracer; + + public EventListener(params (string name, Event callback)[] initializer) + { + foreach (var each in initializer) + { + Add(each.name, each.callback); + } + } + + public void Add(string name, SynchEvent callback) + { + Add(name, (message) => { callback(message); return Task.CompletedTask; }); + } + + public void Add(string name, Event callback) + { + if (callback != null) + { + if (string.IsNullOrEmpty(name)) + { + if (calls.ContainsKey(name)) + { + tracer += callback; + } + else + { + tracer = callback; + } + } + else + { + if (calls.ContainsKey(name)) + { + calls[name ?? System.String.Empty] += callback; + } + else + { + calls[name ?? System.String.Empty] = callback; + } + } + } + } + + + public async Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + using (NoSynchronizationContext) + { + if (!string.IsNullOrEmpty(id) && (calls.TryGetValue(id, out Event listener) || tracer != null)) + { + var message = createMessage(); + message.Id = id; + + await listener?.Invoke(message); + await tracer?.Invoke(message); + + if (token.IsCancellationRequested) + { + throw new OperationCanceledException($"Canceled by event {id} ", this.Token); + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Events.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Events.cs new file mode 100644 index 00000000000..c3b92afa00b --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Events.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + public static partial class Events + { + public const string Log = nameof(Log); + public const string Validation = nameof(Validation); + public const string ValidationWarning = nameof(ValidationWarning); + public const string AfterValidation = nameof(AfterValidation); + public const string RequestCreated = nameof(RequestCreated); + public const string ResponseCreated = nameof(ResponseCreated); + public const string URLCreated = nameof(URLCreated); + public const string Finally = nameof(Finally); + public const string HeaderParametersAdded = nameof(HeaderParametersAdded); + public const string BodyContentSet = nameof(BodyContentSet); + public const string BeforeCall = nameof(BeforeCall); + public const string BeforeResponseDispatch = nameof(BeforeResponseDispatch); + public const string FollowingNextLink = nameof(FollowingNextLink); + public const string DelayBeforePolling = nameof(DelayBeforePolling); + public const string Polling = nameof(Polling); + public const string Progress = nameof(Progress); + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventsExtensions.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventsExtensions.cs new file mode 100644 index 00000000000..ef61532fe9f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/EventsExtensions.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + public static partial class Events + { + public const string CmdletProcessRecordStart = nameof(CmdletProcessRecordStart); + public const string CmdletProcessRecordAsyncStart = nameof(CmdletProcessRecordAsyncStart); + public const string CmdletException = nameof(CmdletException); + public const string CmdletGetPipeline = nameof(CmdletGetPipeline); + public const string CmdletBeforeAPICall = nameof(CmdletBeforeAPICall); + public const string CmdletBeginProcessing = nameof(CmdletBeginProcessing); + public const string CmdletEndProcessing = nameof(CmdletEndProcessing); + public const string CmdletProcessRecordEnd = nameof(CmdletProcessRecordEnd); + public const string CmdletProcessRecordAsyncEnd = nameof(CmdletProcessRecordAsyncEnd); + public const string CmdletAfterAPICall = nameof(CmdletAfterAPICall); + + public const string Verbose = nameof(Verbose); + public const string Debug = nameof(Debug); + public const string Information = nameof(Information); + public const string Error = nameof(Error); + public const string Warning = nameof(Warning); + } + +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Extensions.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Extensions.cs new file mode 100644 index 00000000000..1f15a911a61 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Extensions.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + using System.Linq; + using System; + + internal static partial class Extensions + { + public static T[] SubArray(this T[] array, int offset, int length) + { + return new ArraySegment(array, offset, length) + .ToArray(); + } + + public static T ReadHeaders(this T instance, global::System.Net.Http.Headers.HttpResponseHeaders headers) where T : class + { + (instance as IHeaderSerializable)?.ReadHeaders(headers); + return instance; + } + + internal static bool If(T input, out T output) + { + if (null == input) + { + output = default(T); + return false; + } + output = input; + return true; + } + + internal static void AddIf(T value, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(value); + } + } + + internal static void AddIf(T value, string serializedName, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(serializedName, value); + } + } + + /// + /// Returns the first header value as a string from an HttpReponseMessage. + /// + /// the HttpResponseMessage to fetch a header from + /// the header name + /// the first header value as a string from an HttpReponseMessage. string.empty if there is no header value matching + internal static string GetFirstHeader(this System.Net.Http.HttpResponseMessage response, string headerName) => response.Headers.FirstOrDefault(each => string.Equals(headerName, each.Key, System.StringComparison.OrdinalIgnoreCase)).Value?.FirstOrDefault() ?? string.Empty; + + /// + /// Sets the Synchronization Context to null, and returns an IDisposable that when disposed, + /// will restore the synchonization context to the original value. + /// + /// This is used a less-invasive means to ensure that code in the library that doesn't + /// need to be continued in the original context doesn't have to have ConfigureAwait(false) + /// on every single await + /// + /// If the SynchronizationContext is null when this is used, the resulting IDisposable + /// will not do anything (this prevents excessive re-setting of the SynchronizationContext) + /// + /// Usage: + /// + /// using(NoSynchronizationContext) { + /// await SomeAsyncOperation(); + /// await SomeOtherOperation(); + /// } + /// + /// + /// + /// An IDisposable that will return the SynchronizationContext to original state + internal static System.IDisposable NoSynchronizationContext => System.Threading.SynchronizationContext.Current == null ? Dummy : new NoSyncContext(); + + /// + /// An instance of the Dummy IDispoable. + /// + /// + internal static System.IDisposable Dummy = new DummyDisposable(); + + /// + /// An IDisposable that does absolutely nothing. + /// + internal class DummyDisposable : System.IDisposable + { + public void Dispose() + { + } + } + /// + /// An IDisposable that saves the SynchronizationContext,sets it to null and + /// restores it to the original upon Dispose(). + /// + /// NOTE: This is designed to be less invasive than using .ConfigureAwait(false) + /// on every single await in library code (ie, places where we know we don't need + /// to continue in the same context as we went async) + /// + internal class NoSyncContext : System.IDisposable + { + private System.Threading.SynchronizationContext original = System.Threading.SynchronizationContext.Current; + internal NoSyncContext() + { + System.Threading.SynchronizationContext.SetSynchronizationContext(null); + } + public void Dispose() => System.Threading.SynchronizationContext.SetSynchronizationContext(original); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs new file mode 100644 index 00000000000..f334bb701be --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal static class StringBuilderExtensions + { + /// + /// Extracts the buffered value and resets the buffer + /// + internal static string Extract(this StringBuilder builder) + { + var text = builder.ToString(); + + builder.Clear(); + + return text; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/Extensions/TypeExtensions.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/Extensions/TypeExtensions.cs new file mode 100644 index 00000000000..247ae76d06d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/Extensions/TypeExtensions.cs @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal static class TypeExtensions + { + internal static bool IsNullable(this Type type) => + type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Nullable<>)); + + internal static Type GetOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition() == openGenericInterfaceType) + { + return candidateType; + } + + // Check if it references it's own converter.... + + foreach (Type interfaceType in candidateType.GetInterfaces()) + { + if (interfaceType.IsGenericType + && interfaceType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return interfaceType; + } + } + + return null; + } + + // Author: Sebastian Good + // http://stackoverflow.com/questions/503263/how-to-determine-if-a-type-implements-a-specific-generic-interface-type + internal static bool ImplementsOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + if (candidateType.Equals(openGenericInterfaceType)) + { + return true; + } + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return true; + } + + foreach (Type i in candidateType.GetInterfaces()) + { + if (i.IsGenericType && i.ImplementsOpenGenericInterface(openGenericInterfaceType)) + { + return true; + } + } + + return false; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/Seperator.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/Seperator.cs new file mode 100644 index 00000000000..bd06c883956 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/Seperator.cs @@ -0,0 +1,11 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + internal static class Seperator + { + internal static readonly char[] Dash = { '-' }; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/TypeDetails.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/TypeDetails.cs new file mode 100644 index 00000000000..be5846cd073 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/TypeDetails.cs @@ -0,0 +1,116 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + + + + internal class TypeDetails + { + private readonly Type info; + + internal TypeDetails(Type info) + { + this.info = info ?? throw new ArgumentNullException(nameof(info)); + } + + internal Type NonNullType { get; set; } + + internal object DefaultValue { get; set; } + + internal bool IsNullable { get; set; } + + internal bool IsList { get; set; } + + internal bool IsStringLike { get; set; } + + internal bool IsEnum => info.IsEnum; + + internal bool IsArray => info.IsArray; + + internal bool IsValueType => info.IsValueType; + + internal Type ElementType { get; set; } + + internal IJsonConverter JsonConverter { get; set; } + + #region Creation + + private static readonly ConcurrentDictionary cache = new ConcurrentDictionary(); + + internal static TypeDetails Get() => Get(typeof(T)); + + internal static TypeDetails Get(Type type) => cache.GetOrAdd(type, Create); + + private static TypeDetails Create(Type type) + { + var isGenericList = !type.IsPrimitive && type.ImplementsOpenGenericInterface(typeof(IList<>)); + var isList = !type.IsPrimitive && (isGenericList || typeof(IList).IsAssignableFrom(type)); + + var isNullable = type.IsNullable(); + + Type elementType; + + if (type.IsArray) + { + elementType = type.GetElementType(); + } + else if (isGenericList) + { + var iList = type.GetOpenGenericInterface(typeof(IList<>)); + + elementType = iList.GetGenericArguments()[0]; + } + else + { + elementType = null; + } + + var nonNullType = isNullable ? type.GetGenericArguments()[0] : type; + + var isStringLike = false; + + IJsonConverter converter; + + var jsonConverterAttribute = type.GetCustomAttribute(); + + if (jsonConverterAttribute != null) + { + converter = jsonConverterAttribute.Converter; + } + else if (nonNullType.IsEnum) + { + converter = new EnumConverter(nonNullType); + } + else if (JsonConverterFactory.Instances.TryGetValue(nonNullType, out converter)) + { + } + else if (StringLikeHelper.IsStringLike(nonNullType)) + { + isStringLike = true; + + converter = new StringLikeConverter(nonNullType); + } + + return new TypeDetails(nonNullType) { + NonNullType = nonNullType, + DefaultValue = type.IsValueType ? Activator.CreateInstance(type) : null, + IsNullable = isNullable, + IsList = isList, + IsStringLike = isStringLike, + ElementType = elementType, + JsonConverter = converter + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/XHelper.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/XHelper.cs new file mode 100644 index 00000000000..2cd65f5265a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Helpers/XHelper.cs @@ -0,0 +1,75 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal static class XHelper + { + internal static JsonNode Create(JsonType type, TypeCode code, object value) + { + switch (type) + { + case JsonType.Binary : return new XBinary((byte[])value); + case JsonType.Boolean : return new JsonBoolean((bool)value); + case JsonType.Number : return new JsonNumber(value.ToString()); + case JsonType.String : return new JsonString((string)value); + } + + throw new Exception($"JsonType '{type}' does not have a fast conversion"); + } + + internal static bool TryGetElementType(TypeCode code, out JsonType type) + { + switch (code) + { + case TypeCode.Boolean : type = JsonType.Boolean; return true; + case TypeCode.Byte : type = JsonType.Number; return true; + case TypeCode.DateTime : type = JsonType.Date; return true; + case TypeCode.Decimal : type = JsonType.Number; return true; + case TypeCode.Double : type = JsonType.Number; return true; + case TypeCode.Empty : type = JsonType.Null; return true; + case TypeCode.Int16 : type = JsonType.Number; return true; + case TypeCode.Int32 : type = JsonType.Number; return true; + case TypeCode.Int64 : type = JsonType.Number; return true; + case TypeCode.SByte : type = JsonType.Number; return true; + case TypeCode.Single : type = JsonType.Number; return true; + case TypeCode.String : type = JsonType.String; return true; + case TypeCode.UInt16 : type = JsonType.Number; return true; + case TypeCode.UInt32 : type = JsonType.Number; return true; + case TypeCode.UInt64 : type = JsonType.Number; return true; + } + + type = default; + + return false; + } + + internal static JsonType GetElementType(TypeCode code) + { + switch (code) + { + case TypeCode.Boolean : return JsonType.Boolean; + case TypeCode.Byte : return JsonType.Number; + case TypeCode.DateTime : return JsonType.Date; + case TypeCode.Decimal : return JsonType.Number; + case TypeCode.Double : return JsonType.Number; + case TypeCode.Empty : return JsonType.Null; + case TypeCode.Int16 : return JsonType.Number; + case TypeCode.Int32 : return JsonType.Number; + case TypeCode.Int64 : return JsonType.Number; + case TypeCode.SByte : return JsonType.Number; + case TypeCode.Single : return JsonType.Number; + case TypeCode.String : return JsonType.String; + case TypeCode.UInt16 : return JsonType.Number; + case TypeCode.UInt32 : return JsonType.Number; + case TypeCode.UInt64 : return JsonType.Number; + default : return JsonType.Object; + } + + throw new Exception($"TypeCode '{code}' does not have a fast converter"); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/HttpPipeline.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/HttpPipeline.cs new file mode 100644 index 00000000000..3f556f81353 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/HttpPipeline.cs @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + using GetEventData = System.Func; + using NextDelegate = System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + + using SignalDelegate = System.Func, System.Threading.Tasks.Task>; + using GetParameterDelegate = System.Func, string, object>; + using SendAsyncStepDelegate = System.Func, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + using PipelineChangeDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>; + using ModuleLoadPipelineDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = System.Action, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + +/* + public class DelegateBasedEventListener : IEventListener + { + private EventListenerDelegate _listener; + public DelegateBasedEventListener(EventListenerDelegate listener) + { + _listener = listener; + } + public CancellationToken Token => CancellationToken.None; + public System.Action Cancel => () => { }; + + + public Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + return _listener(id, token, () => createMessage()); + } + } +*/ + /// + /// This is a necessary extension to the SendAsyncFactory to support the 'generic' delegate format. + /// + public partial class SendAsyncFactory + { + /// + /// This translates a generic-defined delegate for a listener into one that fits our ISendAsync pattern. + /// (Provided to support out-of-module delegation for Azure Cmdlets) + /// + /// The Pipeline Step as a delegate + public SendAsyncFactory(SendAsyncStepDelegate step) => this.implementation = (request, listener, next) => + step( + request, + listener.Token, + listener.Cancel, + (id, token, getEventData) => listener.Signal(id, token, () => { + var data = EventDataConverter.ConvertFrom( getEventData() ) as EventData; + data.Id = id; + data.Cancel = listener.Cancel; + data.RequestMessage = request; + return data; + }), + (req, token, cancel, listenerDelegate) => next.SendAsync(req, listener)); + } + + public partial class HttpPipeline : ISendAsync + { + public HttpPipeline Append(SendAsyncStepDelegate item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStepDelegate item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/HttpPipelineMocking.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/HttpPipelineMocking.ps1 new file mode 100644 index 00000000000..2b8cd8913aa --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/HttpPipelineMocking.ps1 @@ -0,0 +1,110 @@ +$ErrorActionPreference = "Stop" + +# get the recording path +if (-not $TestRecordingFile) { + $TestRecordingFile = Join-Path $PSScriptRoot 'recording.json' +} + +# create the Http Pipeline Recorder +$Mock = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PipelineMock $TestRecordingFile + +# set the recorder to the appropriate mode (default to 'live') +Write-Host -ForegroundColor Green "Running '$TestMode' mode..." +switch ($TestMode) { + 'record' { + Write-Host -ForegroundColor Green "Recording to $TestRecordingFile" + $Mock.SetRecord() + $null = erase -ea 0 $TestRecordingFile + } + 'playback' { + if (-not (Test-Path $TestRecordingFile)) { + Write-Host -fore:yellow "Recording file '$TestRecordingFile' is not present. Tests expecting recorded responses will fail" + } else { + Write-Host -ForegroundColor Green "Using recording $TestRecordingFile" + } + $Mock.SetPlayback() + $Mock.ForceResponseHeaders["Retry-After"] = "0"; + } + default: { + $Mock.SetLive() + } +} + +# overrides for Pester Describe/Context/It + +function Describe( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushDescription($Name) + try { + return pester\Describe -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopDescription() + } +} + +function Context( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushContext($Name) + try { + return pester\Context -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopContext() + } +} + +function It { + [CmdletBinding(DefaultParameterSetName = 'Normal')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [string]$Name, + + [Parameter(Position = 1)] + [ScriptBlock] $Test = { }, + + [System.Collections.IDictionary[]] $TestCases, + + [Parameter(ParameterSetName = 'Pending')] + [Switch] $Pending, + + [Parameter(ParameterSetName = 'Skip')] + [Alias('Ignore')] + [Switch] $Skip + ) + $Mock.PushScenario($Name) + + try { + if ($skip) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Skip + } + if ($pending) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Pending + } + return pester\It -Name $Name -Test $Test -TestCases $TestCases + } + finally { + $null = $Mock.PopScenario() + } +} + +# set the HttpPipelineAppend for all the cmdlets +$PSDefaultParameterValues["*:HttpPipelinePrepend"] = $Mock diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/IAssociativeArray.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/IAssociativeArray.cs new file mode 100644 index 00000000000..5a0605cc81e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/IAssociativeArray.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +#define DICT_PROPERTIES +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime +{ + /// A subset of IDictionary that doesn't implement IEnumerable or IDictionary to work around PowerShell's aggressive formatter + public interface IAssociativeArray + { +#if DICT_PROPERTIES + System.Collections.Generic.IEnumerable Keys { get; } + System.Collections.Generic.IEnumerable Values { get; } + int Count { get; } +#endif + System.Collections.Generic.IDictionary AdditionalProperties { get; } + T this[string index] { get; set; } + void Add(string key, T value); + bool ContainsKey(string key); + bool Remove(string key); + bool TryGetValue(string key, out T value); + void Clear(); + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/IHeaderSerializable.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/IHeaderSerializable.cs new file mode 100644 index 00000000000..76ce375a68d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/IHeaderSerializable.cs @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime +{ + public interface IHeaderSerializable + { + void ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers); + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/ISendAsync.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/ISendAsync.cs new file mode 100644 index 00000000000..5da28e67974 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/ISendAsync.cs @@ -0,0 +1,413 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + using System; + + + /// + /// The interface for sending an HTTP request across the wire. + /// + public interface ISendAsync + { + Task SendAsync(HttpRequestMessage request, IEventListener callback); + } + + public class SendAsyncTerminalFactory : ISendAsyncTerminalFactory, ISendAsync + { + SendAsync implementation; + + public SendAsyncTerminalFactory(SendAsync implementation) => this.implementation = implementation; + public SendAsyncTerminalFactory(ISendAsync implementation) => this.implementation = implementation.SendAsync; + public ISendAsync Create() => this; + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback); + } + + public partial class SendAsyncFactory : ISendAsyncFactory + { + public class Sender : ISendAsync + { + internal ISendAsync next; + internal SendAsyncStep implementation; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback, next); + } + SendAsyncStep implementation; + + public SendAsyncFactory(SendAsyncStep implementation) => this.implementation = implementation; + public ISendAsync Create(ISendAsync next) => new Sender { next = next, implementation = implementation }; + + } + + public class HttpClientFactory : ISendAsyncTerminalFactory, ISendAsync + { + HttpClient client; + public HttpClientFactory() : this(new HttpClient()) + { + } + public HttpClientFactory(HttpClient client) => this.client = client; + public ISendAsync Create() => this; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, callback.Token); + } + + public interface ISendAsyncFactory + { + ISendAsync Create(ISendAsync next); + } + + public interface ISendAsyncTerminalFactory + { + ISendAsync Create(); + } + + public partial class HttpPipeline : ISendAsync + { + private const int DefaultMaxRetry = 3; + private ISendAsync pipeline; + private ISendAsyncTerminalFactory terminal; + private List steps = new List(); + + public HttpPipeline() : this(new HttpClientFactory()) + { + } + + public HttpPipeline(ISendAsyncTerminalFactory terminalStep) + { + if (terminalStep == null) + { + throw new System.ArgumentNullException(nameof(terminalStep), "Terminal Step Factory in HttpPipeline may not be null"); + } + TerminalFactory = terminalStep; + } + + /// + /// Returns an HttpPipeline with the current state of this pipeline. + /// + 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; + set + { + if (value == null) + { + throw new System.ArgumentNullException("TerminalFactory in HttpPipeline may not be null"); + } + terminal = value; + } + } + + public ISendAsync Pipeline + { + get + { + // if the pipeline has been created and not invalidated, return it. + if (this.pipeline != null) + { + return this.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. + next = factory.Create(next) ?? next; + } + return this.pipeline = next; + } + } + + public int Count => steps.Count; + + public HttpPipeline Prepend(ISendAsyncFactory item) + { + if (item != null) + { + steps.Add(item); + pipeline = null; + } + return this; + } + + public HttpPipeline Append(SendAsyncStep item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStep item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Append(ISendAsyncFactory item) + { + if (item != null) + { + steps.Insert(0, item); + pipeline = null; + } + return this; + } + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(item); + } + } + return this; + } + + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(item); + } + } + return this; + } + + // you can use this as the ISendAsync Implementation + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => Pipeline.SendAsync(request, callback); + } + + internal static partial class Extensions + { + internal static HttpRequestMessage CloneAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.Clone(requestUri, method); + } + } + + internal static Task CloneWithContentAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.CloneWithContent(requestUri, method); + } + } + + /// + /// Clones an HttpRequestMessage (without the content) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// + /// + /// A clone of the HttpRequestMessage + internal static HttpRequestMessage Clone(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = new HttpRequestMessage + { + Method = method ?? original.Method, + RequestUri = requestUri ?? original.RequestUri, + Version = original.Version, + }; + + foreach (KeyValuePair prop in original.Properties) + { + clone.Properties.Add(prop); + } + + foreach (KeyValuePair> header in original.Headers) + { + /* + **temporarily skip cloning telemetry related headers** + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + */ + if (!"x-ms-unique-id".Equals(header.Key) && !"x-ms-client-request-id".Equals(header.Key) && !"CommandName".Equals(header.Key) && !"FullCommandName".Equals(header.Key) && !"ParameterSetName".Equals(header.Key) && !"User-Agent".Equals(header.Key)) + { + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + } + + return clone; + } + + /// + /// Clones an HttpRequestMessage (including the content stream and content headers) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// + /// + /// A clone of the HttpRequestMessage + internal static async Task CloneWithContent(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = original.Clone(requestUri, method); + var stream = new System.IO.MemoryStream(); + if (original.Content != null) + { + await original.Content.CopyToAsync(stream).ConfigureAwait(false); + stream.Position = 0; + clone.Content = new StreamContent(stream); + if (original.Content.Headers != null) + { + foreach (var h in original.Content.Headers) + { + clone.Content.Headers.Add(h.Key, h.Value); + } + } + } + return clone; + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/InfoAttribute.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/InfoAttribute.cs new file mode 100644 index 00000000000..2d4aca328de --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/InfoAttribute.cs @@ -0,0 +1,38 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + using System; + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)] + 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; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class CompleterInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/InputHandler.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/InputHandler.cs new file mode 100644 index 00000000000..ee186ddbc50 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/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.DataBox.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.DataBox.Runtime.IContext context); + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Iso/IsoDate.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Iso/IsoDate.cs new file mode 100644 index 00000000000..d550ee2060f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Iso/IsoDate.cs @@ -0,0 +1,214 @@ +/*--------------------------------------------------------------------------------------------- + * 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.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal struct IsoDate + { + internal int Year { get; set; } // 0-3000 + + internal int Month { get; set; } // 1-12 + + internal int Day { get; set; } // 1-31 + + internal int Hour { get; set; } // 0-24 + + internal int Minute { get; set; } // 0-60 (60 is a special case) + + internal int Second { get; set; } // 0-60 (60 is used for leap seconds) + + internal double Millisecond { get; set; } // 0-999.9... + + internal TimeSpan Offset { get; set; } + + internal DateTimeKind Kind { get; set; } + + internal TimeSpan TimeOfDay => new TimeSpan(Hour, Minute, Second); + + internal DateTime ToDateTime() + { + if (Kind == DateTimeKind.Utc || Offset == TimeSpan.Zero) + { + return new DateTime(Year, Month, Day, Hour, Minute, Second, (int)Millisecond, DateTimeKind.Utc); + } + + return ToDateTimeOffset().DateTime; + } + + internal DateTimeOffset ToDateTimeOffset() + { + return new DateTimeOffset( + Year, + Month, + Day, + Hour, + Minute, + Second, + (int)Millisecond, + Offset + ); + } + + internal DateTime ToUtcDateTime() + { + return ToDateTimeOffset().UtcDateTime; + } + + public override string ToString() + { + var sb = new StringBuilder(); + + // yyyy-MM-dd + sb.Append($"{Year}-{Month:00}-{Day:00}"); + + if (TimeOfDay > new TimeSpan(0)) + { + sb.Append($"T{Hour:00}:{Minute:00}"); + + if (TimeOfDay.Seconds > 0) + { + sb.Append($":{Second:00}"); + } + } + + if (Offset.Ticks == 0) + { + sb.Append('Z'); // UTC + } + else + { + if (Offset.Ticks >= 0) + { + sb.Append('+'); + } + + sb.Append($"{Offset.Hours:00}:{Offset.Minutes:00}"); + } + + return sb.ToString(); + } + + internal static IsoDate FromDateTimeOffset(DateTimeOffset date) + { + return new IsoDate { + Year = date.Year, + Month = date.Month, + Day = date.Day, + Hour = date.Hour, + Minute = date.Minute, + Second = date.Second, + Offset = date.Offset, + Kind = date.Offset == TimeSpan.Zero ? DateTimeKind.Utc : DateTimeKind.Unspecified + }; + } + + private static readonly char[] timeSeperators = { ':', '.' }; + + internal static IsoDate Parse(string text) + { + var tzIndex = -1; + var timeIndex = text.IndexOf('T'); + + var builder = new IsoDate { Day = 1, Month = 1 }; + + // TODO: strip the time zone offset off the end + string dateTime = text; + string timeZone = null; + + if (dateTime.IndexOf('Z') > -1) + { + tzIndex = dateTime.LastIndexOf('Z'); + + builder.Kind = DateTimeKind.Utc; + } + else if (dateTime.LastIndexOf('+') > 10) + { + tzIndex = dateTime.LastIndexOf('+'); + } + else if (dateTime.LastIndexOf('-') > 10) + { + tzIndex = dateTime.LastIndexOf('-'); + } + + if (tzIndex > -1) + { + timeZone = dateTime.Substring(tzIndex); + dateTime = dateTime.Substring(0, tzIndex); + } + + string date = (timeIndex == -1) ? dateTime : dateTime.Substring(0, timeIndex); + + var dateParts = date.Split(Seperator.Dash); // '-' + + for (int i = 0; i < dateParts.Length; i++) + { + var part = dateParts[i]; + + switch (i) + { + case 0: builder.Year = int.Parse(part); break; + case 1: builder.Month = int.Parse(part); break; + case 2: builder.Day = int.Parse(part); break; + } + } + + if (timeIndex > -1) + { + string[] timeParts = dateTime.Substring(timeIndex + 1).Split(timeSeperators); + + for (int i = 0; i < timeParts.Length; i++) + { + var part = timeParts[i]; + + switch (i) + { + case 0: builder.Hour = int.Parse(part); break; + case 1: builder.Minute = int.Parse(part); break; + case 2: builder.Second = int.Parse(part); break; + case 3: builder.Millisecond = double.Parse("0." + part) * 1000; break; + } + } + } + + if (timeZone != null && timeZone != "Z") + { + var hours = int.Parse(timeZone.Substring(1, 2)); + var minutes = int.Parse(timeZone.Substring(4, 2)); + + if (timeZone[0] == '-') + { + hours = -hours; + minutes = -minutes; + } + + builder.Offset = new TimeSpan(hours, minutes, 0); + } + + return builder; + } + } + + /* + YYYY # eg 1997 + YYYY-MM # eg 1997-07 + YYYY-MM-DD # eg 1997-07-16 + YYYY-MM-DDThh:mmTZD # eg 1997-07-16T19:20+01:00 + YYYY-MM-DDThh:mm:ssTZD # eg 1997-07-16T19:20:30+01:00 + YYYY-MM-DDThh:mm:ss.sTZD # eg 1997-07-16T19:20:30.45+01:00 + + where: + + YYYY = four-digit year + MM = two-digit month (01=January, etc.) + DD = two-digit day of month (01 through 31) + hh = two digits of hour (00 through 23) (am/pm NOT allowed) + mm = two digits of minute (00 through 59) + ss = two digits of second (00 through 59) + s = one or more digits representing a decimal fraction of a second + TZD = time zone designator (Z or +hh:mm or -hh:mm) + */ +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/JsonType.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/JsonType.cs new file mode 100644 index 00000000000..859bcfb64b2 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/JsonType.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + internal enum JsonType + { + Null = 0, + Object = 1, + Array = 2, + Binary = 3, + Boolean = 4, + Date = 5, + Number = 6, + String = 7 + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/MessageAttribute.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/MessageAttribute.cs new file mode 100644 index 00000000000..78d11dc2559 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/MessageAttribute.cs @@ -0,0 +1,353 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.generated.runtime.Properties; + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Linq; + using System.Management.Automation; + using System.Text; + + [AttributeUsage(AttributeTargets.All)] + public class GenericBreakingChangeAttribute : Attribute + { + private string _message; + //A description of what the change is about, non mandatory + public string ChangeDescription { get; set; } = null; + + //Name of the module that is being deprecated + public string moduleName { get; set; } = String.IsNullOrEmpty(@"") ? @"Az.DataBox" : @""; + + //The version the change is effective from, non mandatory + public string DeprecateByVersion { get; } + public string DeprecateByAzVersion { get; } + + //The date on which the change comes in effect + public DateTime ChangeInEfectByDate { get; } + public bool ChangeInEfectByDateSet { get; } = false; + + //Old way of calling the cmdlet + public string OldWay { get; set; } + //New way fo calling the cmdlet + public string NewWay { get; set; } + + public GenericBreakingChangeAttribute(string message, string deprecateByAzVersion, string deprecateByVersion) + { + _message = message; + this.DeprecateByAzVersion = deprecateByAzVersion; + this.DeprecateByVersion = deprecateByVersion; + } + + public GenericBreakingChangeAttribute(string message, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) + { + _message = message; + this.DeprecateByVersion = deprecateByVersion; + this.DeprecateByAzVersion = deprecateByAzVersion; + + if (DateTime.TryParse(changeInEfectByDate, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) + { + this.ChangeInEfectByDate = result; + this.ChangeInEfectByDateSet = true; + } + } + + public DateTime getInEffectByDate() + { + return this.ChangeInEfectByDate.Date; + } + + + /** + * This function prints out the breaking change message for the attribute on the cmdline + * */ + public void PrintCustomAttributeInfo(Action writeOutput) + { + + if (!GetAttributeSpecificMessage().StartsWith(Environment.NewLine)) + { + writeOutput(Environment.NewLine); + } + writeOutput(string.Format(Resources.BreakingChangesAttributesDeclarationMessage, GetAttributeSpecificMessage())); + + + if (!string.IsNullOrWhiteSpace(ChangeDescription)) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesChangeDescriptionMessage, this.ChangeDescription)); + } + + if (ChangeInEfectByDateSet) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByDateMessage, this.ChangeInEfectByDate.ToString("d"))); + } + + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByAzVersion, this.DeprecateByAzVersion)); + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.moduleName, this.DeprecateByVersion)); + + if (OldWay != null && NewWay != null) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesUsageChangeMessageConsole, OldWay, NewWay)); + } + } + + public virtual bool IsApplicableToInvocation(InvocationInfo invocation) + { + return true; + } + + protected virtual string GetAttributeSpecificMessage() + { + return _message; + } + } + + [AttributeUsage(AttributeTargets.All)] + public class CmdletBreakingChangeAttribute : GenericBreakingChangeAttribute + { + + public string ReplacementCmdletName { get; set; } + + public CmdletBreakingChangeAttribute(string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) + { + } + + public CmdletBreakingChangeAttribute(string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) + { + } + + protected override string GetAttributeSpecificMessage() + { + if (string.IsNullOrWhiteSpace(ReplacementCmdletName)) + { + return Resources.BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement; + } + else + { + return string.Format(Resources.BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement, ReplacementCmdletName); + } + } + } + + [AttributeUsage(AttributeTargets.All)] + public class ParameterSetBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string[] ChangedParameterSet { set; get; } + + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) + { + ChangedParameterSet = changedParameterSet; + } + + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) + { + ChangedParameterSet = changedParameterSet; + } + + protected override string GetAttributeSpecificMessage() + { + + return Resources.BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement; + + } + + public bool IsApplicableToInvocation(InvocationInfo invocation, string parameterSetName) + { + if (ChangedParameterSet != null) + return ChangedParameterSet.Contains(parameterSetName); + return false; + } + + } + + [AttributeUsage(AttributeTargets.All)] + public class PreviewMessageAttribute : Attribute + { + public string _message; + + public DateTime EstimatedGaDate { get; } + + public bool IsEstimatedGaDateSet { get; } = false; + + + public PreviewMessageAttribute() + { + this._message = Resources.PreviewCmdletMessage; + } + + public PreviewMessageAttribute(string message) + { + this._message = string.IsNullOrEmpty(message) ? Resources.PreviewCmdletMessage : message; + } + + public PreviewMessageAttribute(string message, string estimatedDateOfGa) : this(message) + { + if (DateTime.TryParse(estimatedDateOfGa, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) + { + this.EstimatedGaDate = result; + this.IsEstimatedGaDateSet = true; + } + } + + public void PrintCustomAttributeInfo(Action writeOutput) + { + writeOutput(this._message); + + if (IsEstimatedGaDateSet) + { + writeOutput(string.Format(Resources.PreviewCmdletETAMessage, this.EstimatedGaDate.ToShortDateString())); + } + } + + public virtual bool IsApplicableToInvocation(InvocationInfo invocation) + { + return true; + } + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class ParameterBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string NameOfParameterChanging { get; } + + public string ReplaceMentCmdletParameterName { get; set; } = null; + + public bool IsBecomingMandatory { get; set; } = false; + + public String OldParamaterType { get; set; } + + public String NewParameterType { get; set; } + + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) + { + this.NameOfParameterChanging = nameOfParameterChanging; + } + + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) + { + this.NameOfParameterChanging = nameOfParameterChanging; + } + + protected override string GetAttributeSpecificMessage() + { + StringBuilder message = new StringBuilder(); + if (!string.IsNullOrWhiteSpace(ReplaceMentCmdletParameterName)) + { + if (IsBecomingMandatory) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterReplacedMandatory, NameOfParameterChanging, ReplaceMentCmdletParameterName)); + } + else + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterReplaced, NameOfParameterChanging, ReplaceMentCmdletParameterName)); + } + } + else + { + if (IsBecomingMandatory) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterMandatoryNow, NameOfParameterChanging)); + } + else + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterChanging, NameOfParameterChanging)); + } + } + + //See if the type of the param is changing + if (OldParamaterType != null && !string.IsNullOrWhiteSpace(NewParameterType)) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterTypeChange, OldParamaterType, NewParameterType)); + } + return message.ToString(); + } + + /// + /// See if the bound parameters contain the current parameter, if they do + /// then the attribbute is applicable + /// If the invocationInfo is null we return true + /// + /// + /// bool + public override bool IsApplicableToInvocation(InvocationInfo invocationInfo) + { + bool? applicable = invocationInfo == null ? true : invocationInfo.BoundParameters?.Keys?.Contains(this.NameOfParameterChanging); + return applicable.HasValue ? applicable.Value : false; + } + } + + [AttributeUsage(AttributeTargets.All)] + public class OutputBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string DeprecatedCmdLetOutputType { get; } + + //This is still a String instead of a Type as this + //might be undefined at the time of adding the attribute + public string ReplacementCmdletOutputType { get; set; } + + public string[] DeprecatedOutputProperties { get; set; } + + public string[] NewOutputProperties { get; set; } + + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) + { + this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; + } + + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) + { + this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; + } + + protected override string GetAttributeSpecificMessage() + { + StringBuilder message = new StringBuilder(); + + //check for the deprecation scenario + if (string.IsNullOrWhiteSpace(ReplacementCmdletOutputType) && NewOutputProperties == null && DeprecatedOutputProperties == null && string.IsNullOrWhiteSpace(ChangeDescription)) + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputTypeDeprecated, DeprecatedCmdLetOutputType)); + } + else + { + if (!string.IsNullOrWhiteSpace(ReplacementCmdletOutputType)) + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputChange1, DeprecatedCmdLetOutputType, ReplacementCmdletOutputType)); + } + else + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputChange2, DeprecatedCmdLetOutputType)); + } + + if (DeprecatedOutputProperties != null && DeprecatedOutputProperties.Length > 0) + { + message.Append(Resources.BreakingChangesAttributesCmdLetOutputPropertiesRemoved); + foreach (string property in DeprecatedOutputProperties) + { + message.Append(" '" + property + "'"); + } + } + + if (NewOutputProperties != null && NewOutputProperties.Length > 0) + { + message.Append(Resources.BreakingChangesAttributesCmdLetOutputPropertiesAdded); + foreach (string property in NewOutputProperties) + { + message.Append(" '" + property + "'"); + } + } + } + return message.ToString(); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/MessageAttributeHelper.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/MessageAttributeHelper.cs new file mode 100644 index 00000000000..3b2d049e9b7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/MessageAttributeHelper.cs @@ -0,0 +1,184 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime +{ + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.generated.runtime.Properties; + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Reflection; + using System.Text; + using System.Threading.Tasks; + public class MessageAttributeHelper + { + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + public const string BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK = "https://aka.ms/azps-changewarnings"; + public const string SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME = "SuppressAzurePowerShellBreakingChangeWarnings"; + + /** + * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) + * And reads all the deprecation attributes attached to it + * Prints a message on the cmdline For each of the attribute found + * + * the boundParameterNames is a list of parameters bound to the cmdlet at runtime, + * We only process the Parameter beaking change attributes attached only params listed in this list (if present) + * */ + public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet, bool showPreviewMessage = true) + { + bool supressWarningOrError = false; + + try + { + supressWarningOrError = bool.Parse(System.Environment.GetEnvironmentVariable(SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME)); + } + catch (Exception) + { + //no action + } + + if (supressWarningOrError) + { + //Do not process the attributes at runtime... The env variable to override the warning messages is set + return; + } + if (IsAzure && invocationInfo.BoundParameters.ContainsKey("DefaultProfile")) + { + psCmdlet.WriteWarning("The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription."); + } + + ProcessBreakingChangeAttributesAtRuntime(commandInfo, invocationInfo, parameterSet, psCmdlet); + + } + + private static void ProcessBreakingChangeAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { + List attributes = new List(GetAllBreakingChangeAttributesInType(commandInfo, invocationInfo, parameterSet)); + StringBuilder sb = new StringBuilder(); + Action appendAttributeMessage = (string s) => sb.Append(s); + + if (attributes != null && attributes.Count > 0) + { + appendAttributeMessage(string.Format(Resources.BreakingChangesAttributesHeaderMessage, commandInfo.Name.Split('_')[0])); + + foreach (GenericBreakingChangeAttribute attribute in attributes) + { + attribute.PrintCustomAttributeInfo(appendAttributeMessage); + } + + appendAttributeMessage(string.Format(Resources.BreakingChangesAttributesFooterMessage, BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK)); + + psCmdlet.WriteWarning(sb.ToString()); + } + } + + + public static void ProcessPreviewMessageAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { + List previewAttributes = new List(GetAllPreviewAttributesInType(commandInfo, invocationInfo)); + StringBuilder sb = new StringBuilder(); + Action appendAttributeMessage = (string s) => sb.Append(s); + + if (previewAttributes != null && previewAttributes.Count > 0) + { + foreach (PreviewMessageAttribute attribute in previewAttributes) + { + attribute.PrintCustomAttributeInfo(appendAttributeMessage); + } + psCmdlet.WriteWarning(sb.ToString()); + } + } + + /** + * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) + * And returns all the deprecation attributes attached to it + * + * the boundParameterNames is a list of parameters bound to the cmdlet at runtime, + * We only process the Parameter beaking change attributes attached only params listed in this list (if present) + **/ + private static IEnumerable GetAllBreakingChangeAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet) + { + List attributeList = new List(); + + if (commandInfo.GetType() == typeof(CmdletInfo)) + { + var type = ((CmdletInfo)commandInfo).ImplementingType; + attributeList.AddRange(type.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + + foreach (MethodInfo m in type.GetRuntimeMethods()) + { + attributeList.AddRange((m.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast())); + } + + foreach (FieldInfo f in type.GetRuntimeFields()) + { + attributeList.AddRange(f.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + } + + foreach (PropertyInfo p in type.GetRuntimeProperties()) + { + attributeList.AddRange(p.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + } + } + else if (commandInfo.GetType() == typeof(FunctionInfo)) + { + attributeList.AddRange(((FunctionInfo)commandInfo).ScriptBlock.Attributes.Where(e => typeof(GenericBreakingChangeAttribute).IsAssignableFrom(e.GetType())).Cast()); + foreach (var parameter in ((FunctionInfo)commandInfo).Parameters) + { + attributeList.AddRange(parameter.Value.Attributes.Where(e => typeof(GenericBreakingChangeAttribute).IsAssignableFrom(e.GetType())).Cast()); + } + } + return invocationInfo == null ? attributeList : attributeList.Where(e => e.GetType() == typeof(ParameterSetBreakingChangeAttribute) ? ((ParameterSetBreakingChangeAttribute)e).IsApplicableToInvocation(invocationInfo, parameterSet) : e.IsApplicableToInvocation(invocationInfo)); + } + + public static bool ContainsPreviewAttribute(CommandInfo commandInfo, InvocationInfo invocationInfo) + { + return GetAllPreviewAttributesInType(commandInfo, invocationInfo)?.Count() > 0; + } + + private static IEnumerable GetAllPreviewAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo) + { + List attributeList = new List(); + if (commandInfo.GetType() == typeof(CmdletInfo)) + { + var type = ((CmdletInfo)commandInfo).ImplementingType; + attributeList.AddRange(type.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + + foreach (MethodInfo m in type.GetRuntimeMethods()) + { + attributeList.AddRange((m.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast())); + } + + foreach (FieldInfo f in type.GetRuntimeFields()) + { + attributeList.AddRange(f.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + } + + foreach (PropertyInfo p in type.GetRuntimeProperties()) + { + attributeList.AddRange(p.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + } + } + else if (commandInfo.GetType() == typeof(FunctionInfo)) + { + attributeList.AddRange(((FunctionInfo)commandInfo).ScriptBlock.Attributes.Where(e => typeof(PreviewMessageAttribute).IsAssignableFrom(e.GetType())).Cast()); + foreach (var parameter in ((FunctionInfo)commandInfo).Parameters) + { + attributeList.AddRange(parameter.Value.Attributes.Where(e => typeof(PreviewMessageAttribute).IsAssignableFrom(e.GetType())).Cast()); + } + } + return invocationInfo == null ? attributeList : attributeList.Where(e => e.IsApplicableToInvocation(invocationInfo)); + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Method.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Method.cs new file mode 100644 index 00000000000..855207f61ca --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Method.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + internal static class Method + { + internal static System.Net.Http.HttpMethod Get = System.Net.Http.HttpMethod.Get; + internal static System.Net.Http.HttpMethod Put = System.Net.Http.HttpMethod.Put; + internal static System.Net.Http.HttpMethod Head = System.Net.Http.HttpMethod.Head; + internal static System.Net.Http.HttpMethod Post = System.Net.Http.HttpMethod.Post; + internal static System.Net.Http.HttpMethod Delete = System.Net.Http.HttpMethod.Delete; + internal static System.Net.Http.HttpMethod Options = System.Net.Http.HttpMethod.Options; + internal static System.Net.Http.HttpMethod Trace = System.Net.Http.HttpMethod.Trace; + internal static System.Net.Http.HttpMethod Patch = new System.Net.Http.HttpMethod("PATCH"); + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Models/JsonMember.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Models/JsonMember.cs new file mode 100644 index 00000000000..2c721e85be9 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Models/JsonMember.cs @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * 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.Reflection; +using System.Runtime.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + + + internal sealed class JsonMember + { + private readonly TypeDetails type; + + private readonly Func getter; + private readonly Action setter; + + internal JsonMember(PropertyInfo property, int defaultOrder) + { + getter = property.GetValue; + setter = property.SetValue; + + var dataMember = property.GetCustomAttribute(); + + Name = dataMember?.Name ?? property.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(property.PropertyType); + + CanRead = property.CanRead; + } + + internal JsonMember(FieldInfo field, int defaultOrder) + { + getter = field.GetValue; + setter = field.SetValue; + + var dataMember = field.GetCustomAttribute(); + + Name = dataMember?.Name ?? field.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(field.FieldType); + + CanRead = true; + } + + internal string Name { get; } + + internal int Order { get; } + + internal TypeDetails TypeDetails => type; + + internal Type Type => type.NonNullType; + + internal bool IsList => type.IsList; + + // Arrays, Sets, ... + internal Type ElementType => type.ElementType; + + internal IJsonConverter Converter => type.JsonConverter; + + internal bool EmitDefaultValue { get; } + + internal bool IsStringLike => type.IsStringLike; + + internal object DefaultValue => type.DefaultValue; + + internal bool CanRead { get; } + + #region Helpers + + internal object GetValue(object instance) => getter(instance); + + internal void SetValue(object instance, object value) => setter(instance, value); + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Models/JsonModel.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Models/JsonModel.cs new file mode 100644 index 00000000000..84455ba0c05 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Models/JsonModel.cs @@ -0,0 +1,89 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Runtime.Serialization; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal class JsonModel + { + private Dictionary map; + private readonly object _sync = new object(); + + private JsonModel(Type type, List members) + { + Type = type ?? throw new ArgumentNullException(nameof(type)); + Members = members ?? throw new ArgumentNullException(nameof(members)); + } + + internal string Name => Type.Name; + + internal Type Type { get; } + + internal List Members { get; } + + internal JsonMember this[string name] + { + get + { + if (map == null) + { + lock (_sync) + { + if (map == null) + { + map = new Dictionary(); + + foreach (JsonMember m in Members) + { + map[m.Name.ToLower()] = m; + } + } + } + } + + + map.TryGetValue(name.ToLower(), out JsonMember member); + + return member; + } + } + + internal static JsonModel FromType(Type type) + { + var members = new List(); + + int i = 0; + + // BindingFlags.Instance | BindingFlags.Public + + foreach (var member in type.GetFields()) + { + if (member.IsStatic) continue; + + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + foreach (var member in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + members.Sort((a, b) => a.Order.CompareTo(b.Order)); // inline sort + + return new JsonModel(type, members); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Models/JsonModelCache.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Models/JsonModelCache.cs new file mode 100644 index 00000000000..6cf07745731 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Models/JsonModelCache.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * 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.Runtime.CompilerServices; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal static class JsonModelCache + { + private static readonly ConditionalWeakTable cache + = new ConditionalWeakTable(); + + internal static JsonModel Get(Type type) => cache.GetValue(type, Create); + + private static JsonModel Create(Type type) => JsonModel.FromType(type); + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/JsonArray.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/JsonArray.cs new file mode 100644 index 00000000000..27081d70d02 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/JsonArray.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public abstract partial class JsonArray : JsonNode, IEnumerable + { + internal override JsonType Type => JsonType.Array; + + internal abstract JsonType? ElementType { get; } + + public abstract int Count { get; } + + internal virtual bool IsSet => false; + + internal bool IsEmpty => Count == 0; + + #region IEnumerable + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + #endregion + + #region Static Helpers + + internal static JsonArray Create(short[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(int[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(long[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(decimal[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(float[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(string[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(XBinary[] values) + => new XImmutableArray(values); + + #endregion + + internal static new JsonArray Parse(string text) + => (JsonArray)JsonNode.Parse(text); + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XImmutableArray.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XImmutableArray.cs new file mode 100644 index 00000000000..7f010336b75 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XImmutableArray.cs @@ -0,0 +1,62 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal sealed class XImmutableArray : JsonArray, IEnumerable + { + private readonly T[] values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XImmutableArray(T[] values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Length; + + public bool IsReadOnly => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + #region Static Constructor + + internal XImmutableArray Create(T[] items) + { + return new XImmutableArray(items); + } + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XList.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XList.cs new file mode 100644 index 00000000000..678a72befe8 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XList.cs @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal sealed class XList : JsonArray, IEnumerable + { + private readonly IList values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XList(IList values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Count; + + public bool IsReadOnly => values.IsReadOnly; + + #region IList + + public void Add(T value) + { + values.Add(value); + } + + public bool Contains(T value) => values.Contains(value); + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XNodeArray.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XNodeArray.cs new file mode 100644 index 00000000000..a015a7fd05d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XNodeArray.cs @@ -0,0 +1,73 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed partial class XNodeArray : JsonArray, ICollection + { + private readonly List items; + + internal XNodeArray() + { + items = new List(); + } + + 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; + + public bool IsReadOnly => false; + + public override int Count => items.Count; + + #region ICollection Members + + public void Add(JsonNode item) + { + items.Add(item); + } + + void ICollection.Clear() + { + items.Clear(); + } + + public bool Contains(JsonNode item) => items.Contains(item); + + void ICollection.CopyTo(JsonNode[] array, int arrayIndex) + { + items.CopyTo(array, arrayIndex); + } + + public bool Remove(JsonNode item) + { + return items.Remove(item); + } + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XSet.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XSet.cs new file mode 100644 index 00000000000..0fa374add7e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/Collections/XSet.cs @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal sealed class XSet : JsonArray, IEnumerable + { + private readonly HashSet values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XSet(IEnumerable values) + : this(new HashSet(values)) + { } + + internal XSet(HashSet values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + internal override JsonType Type => JsonType.Array; + + internal override JsonType? ElementType => elementType; + + public bool IsReadOnly => true; + + public override int Count => values.Count; + + internal override bool IsSet => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + internal HashSet AsHashSet() => values; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonBoolean.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonBoolean.cs new file mode 100644 index 00000000000..c9ca1e5a8fe --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonBoolean.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal sealed partial class JsonBoolean : JsonNode + { + internal static readonly JsonBoolean True = new JsonBoolean(true); + internal static readonly JsonBoolean False = new JsonBoolean(false); + + internal JsonBoolean(bool value) + { + Value = value; + } + + internal bool Value { get; } + + internal override JsonType Type => JsonType.Boolean; + + internal static new JsonBoolean Parse(string text) + { + switch (text) + { + case "false": return False; + case "true": return True; + + default: throw new ArgumentException($"Expected true or false. Was {text}."); + } + } + + #region Implicit Casts + + public static implicit operator bool(JsonBoolean data) => data.Value; + + public static implicit operator JsonBoolean(bool data) => new JsonBoolean(data); + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonDate.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonDate.cs new file mode 100644 index 00000000000..b027f084572 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonDate.cs @@ -0,0 +1,173 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + + + internal sealed partial class JsonDate : JsonNode, IEquatable, IComparable + { + internal static bool AssumeUtcWhenKindIsUnspecified = true; + + private readonly DateTimeOffset value; + + internal JsonDate(DateTime value) + { + if (value.Kind == DateTimeKind.Unspecified && AssumeUtcWhenKindIsUnspecified) + { + value = DateTime.SpecifyKind(value, DateTimeKind.Utc); + } + + this.value = value; + } + + internal JsonDate(DateTimeOffset value) + { + this.value = value; + } + + internal override JsonType Type => JsonType.Date; + + #region Helpers + + internal DateTimeOffset ToDateTimeOffset() + { + return value; + } + + internal DateTime ToDateTime() + { + if (value.Offset == TimeSpan.Zero) + { + return value.UtcDateTime; + } + + return value.DateTime; + } + + internal DateTime ToUtcDateTime() => value.UtcDateTime; + + internal int ToUnixTimeSeconds() + { + return (int)value.ToUnixTimeSeconds(); + } + + internal long ToUnixTimeMilliseconds() + { + return (int)value.ToUnixTimeMilliseconds(); + } + + internal string ToIsoString() + { + return IsoDate.FromDateTimeOffset(value).ToString(); + } + + #endregion + + public override string ToString() + { + return ToIsoString(); + } + + internal static new JsonDate Parse(string text) + { + if (text == null) throw new ArgumentNullException(nameof(text)); + + // TODO support: unixtimeseconds.partialseconds + + if (text.Length > 4 && _IsNumber(text)) // UnixTime + { + var date = DateTimeOffset.FromUnixTimeSeconds(long.Parse(text)); + + return new JsonDate(date); + } + else if (text.Length <= 4 || text[4] == '-') // ISO: 2012- + { + return new JsonDate(IsoDate.Parse(text).ToDateTimeOffset()); + } + else + { + // NOT ISO ENCODED + // "Thu, 5 Apr 2012 16:59:01 +0200", + return new JsonDate(DateTimeOffset.Parse(text)); + } + } + + private static bool _IsNumber(string text) + { + foreach (var c in text) + { + if (!char.IsDigit(c)) return false; + } + + return true; + } + + internal static JsonDate FromUnixTime(int seconds) + { + return new JsonDate(DateTimeOffset.FromUnixTimeSeconds(seconds)); + } + + internal static JsonDate FromUnixTime(double seconds) + { + var milliseconds = (long)(seconds * 1000d); + + return new JsonDate(DateTimeOffset.FromUnixTimeMilliseconds(milliseconds)); + } + + #region Implicit Casts + + public static implicit operator DateTimeOffset(JsonDate value) + => value.ToDateTimeOffset(); + + public static implicit operator DateTime(JsonDate value) + => value.ToDateTime(); + + // From Date + public static implicit operator JsonDate(DateTimeOffset value) + { + return new JsonDate(value); + } + + public static implicit operator JsonDate(DateTime value) + { + return new JsonDate(value); + } + + // From String + public static implicit operator JsonDate(string value) + { + return Parse(value); + } + + #endregion + + #region Equality + + public override bool Equals(object obj) + { + return obj is JsonDate date && date.value == this.value; + } + + public bool Equals(JsonDate other) + { + return this.value == other.value; + } + + public override int GetHashCode() => value.GetHashCode(); + + #endregion + + #region IComparable Members + + int IComparable.CompareTo(JsonDate other) + { + return value.CompareTo(other.value); + } + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonNode.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonNode.cs new file mode 100644 index 00000000000..c00a2df9d02 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonNode.cs @@ -0,0 +1,250 @@ +/*--------------------------------------------------------------------------------------------- + * 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.IO; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + + + public abstract partial class JsonNode + { + internal abstract JsonType Type { get; } + + public virtual JsonNode this[int index] => throw new NotImplementedException(); + + public virtual JsonNode this[string name] + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + #region Type Helpers + + internal bool IsArray => Type == JsonType.Array; + + internal bool IsDate => Type == JsonType.Date; + + internal bool IsObject => Type == JsonType.Object; + + internal bool IsNumber => Type == JsonType.Number; + + internal bool IsNull => Type == JsonType.Null; + + #endregion + + internal void WriteTo(TextWriter textWriter, bool pretty = true) + { + var writer = new JsonWriter(textWriter, pretty); + + writer.WriteNode(this); + } + + internal T As() + where T : new() + => new JsonSerializer().Deseralize((JsonObject)this); + + internal T[] ToArrayOf() + { + return (T[])new JsonSerializer().DeserializeArray(typeof(T[]), (JsonArray)this); + } + + #region ToString Overrides + + public override string ToString() => ToString(pretty: true); + + internal string ToString(bool pretty) + { + var sb = new StringBuilder(); + + using (var writer = new StringWriter(sb)) + { + WriteTo(writer, pretty); + + return sb.ToString(); + } + } + + #endregion + + #region Static Constructors + + internal static JsonNode Parse(string text) + { + return Parse(new SourceReader(new StringReader(text))); + } + + internal static JsonNode Parse(TextReader textReader) + => Parse(new SourceReader(textReader)); + + private static JsonNode Parse(SourceReader sourceReader) + { + using (var parser = new JsonParser(sourceReader)) + { + return parser.ReadNode(); + } + } + + internal static JsonNode FromObject(object instance) + => new JsonSerializer().Serialize(instance); + + #endregion + + #region Implict Casts + + public static implicit operator string(JsonNode node) => node.ToString(); + + #endregion + + #region Explict Casts + + public static explicit operator DateTime(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date: + return ((JsonDate)node).ToDateTime(); + + case JsonType.String: + return JsonDate.Parse(node.ToString()).ToDateTime(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num).UtcDateTime; + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)).UtcDateTime; + } + } + + throw new ConversionException(node, typeof(DateTime)); + } + + public static explicit operator DateTimeOffset(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date : return ((JsonDate)node).ToDateTimeOffset(); + case JsonType.String : return JsonDate.Parse(node.ToString()).ToDateTimeOffset(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num); + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)); + } + + } + + throw new ConversionException(node, typeof(DateTimeOffset)); + } + + public static explicit operator float(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return float.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(float)); + } + + public static explicit operator double(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return double.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(double)); + } + + public static explicit operator decimal(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return decimal.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(decimal)); + } + + public static explicit operator Guid(JsonNode node) + => new Guid(node.ToString()); + + public static explicit operator short(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return short.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(short)); + } + + public static explicit operator int(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return int.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(int)); + } + + public static explicit operator long(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return long.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(long)); + } + + public static explicit operator bool(JsonNode node) + => ((JsonBoolean)node).Value; + + public static explicit operator ushort(JsonNode node) + => (JsonNumber)node; + + public static explicit operator uint(JsonNode node) + => (JsonNumber)node; + + public static explicit operator ulong(JsonNode node) + => (JsonNumber)node; + + public static explicit operator TimeSpan(JsonNode node) + => TimeSpan.Parse(node.ToString()); + + public static explicit operator Uri(JsonNode node) + { + if (node.Type == JsonType.String) + { + return new Uri(node.ToString()); + } + + throw new ConversionException(node, typeof(Uri)); + } + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonNumber.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonNumber.cs new file mode 100644 index 00000000000..c5eb4800f44 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonNumber.cs @@ -0,0 +1,109 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed partial class JsonNumber : JsonNode + { + private readonly string value; + private readonly bool overflows = false; + + internal JsonNumber(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal JsonNumber(int value) + { + this.value = value.ToString(); + } + + internal JsonNumber(long value) + { + this.value = value.ToString(); + + if (value > 9007199254740991) + { + overflows = true; + } + } + + internal JsonNumber(float value) + { + this.value = value.ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal JsonNumber(double value) + { + this.value = value.ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal override JsonType Type => JsonType.Number; + + internal string Value => value; + + #region Helpers + + internal bool Overflows => overflows; + + internal bool IsInteger => !value.Contains("."); + + internal bool IsFloat => value.Contains("."); + + #endregion + + #region Casting + + public static implicit operator byte(JsonNumber number) + => byte.Parse(number.Value); + + public static implicit operator short(JsonNumber number) + => short.Parse(number.Value); + + public static implicit operator int(JsonNumber number) + => int.Parse(number.Value); + + public static implicit operator long(JsonNumber number) + => long.Parse(number.value); + + public static implicit operator UInt16(JsonNumber number) + => ushort.Parse(number.Value); + + public static implicit operator UInt32(JsonNumber number) + => uint.Parse(number.Value); + + public static implicit operator UInt64(JsonNumber number) + => ulong.Parse(number.Value); + + public static implicit operator decimal(JsonNumber number) + => decimal.Parse(number.Value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator Double(JsonNumber number) + => double.Parse(number.value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator float(JsonNumber number) + => float.Parse(number.value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator JsonNumber(short data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(int data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(long data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(Single data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(double data) + => new JsonNumber(data.ToString()); + + #endregion + + public override string ToString() => value; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonObject.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonObject.cs new file mode 100644 index 00000000000..4831a505e13 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonObject.cs @@ -0,0 +1,172 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public partial class JsonObject : JsonNode, IDictionary + { + private readonly Dictionary items; + + internal JsonObject() + { + items = new Dictionary(); + } + + internal JsonObject(IEnumerable> properties) + { + if (properties == null) throw new ArgumentNullException(nameof(properties)); + + items = new Dictionary(); + + foreach (var field in properties) + { + items.Add(field.Key, field.Value); + } + } + + #region IDictionary Constructors + + internal JsonObject(IDictionary dic) + { + items = new Dictionary(dic.Count); + + foreach (var pair in dic) + { + Add(pair.Key, pair.Value); + } + } + + #endregion + + internal override JsonType Type => JsonType.Object; + + #region Add Overloads + + public void Add(string name, JsonNode value) => + items.Add(name, value); + + public void Add(string name, byte[] value) => + items.Add(name, new XBinary(value)); + + public void Add(string name, DateTime value) => + items.Add(name, new JsonDate(value)); + + public void Add(string name, int value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, long value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, float value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, double value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, string value) => + items.Add(name, new JsonString(value)); + + public void Add(string name, bool value) => + items.Add(name, new JsonBoolean(value)); + + public void Add(string name, Uri url) => + items.Add(name, new JsonString(url.AbsoluteUri)); + + public void Add(string name, string[] values) => + items.Add(name, new XImmutableArray(values)); + + public void Add(string name, int[] values) => + items.Add(name, new XImmutableArray(values)); + + #endregion + + #region ICollection> Members + + void ICollection>.Add(KeyValuePair item) + { + items.Add(item.Key, item.Value); + } + + void ICollection>.Clear() + { + items.Clear(); + } + + bool ICollection>.Contains(KeyValuePair item) => + throw new NotImplementedException(); + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => + throw new NotImplementedException(); + + + int ICollection>.Count => items.Count; + + bool ICollection>.IsReadOnly => false; + + bool ICollection>.Remove(KeyValuePair item) => + throw new NotImplementedException(); + + #endregion + + #region IDictionary Members + + public bool ContainsKey(string key) => items.ContainsKey(key); + + public ICollection Keys => items.Keys; + + public bool Remove(string key) => items.Remove(key); + + public bool TryGetValue(string key, out JsonNode value) => + items.TryGetValue(key, out value); + + public ICollection Values => items.Values; + + public override JsonNode this[string key] + { + get => items[key]; + set => items[key] = value; + } + + #endregion + + #region IEnumerable + + IEnumerator> IEnumerable>.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + + #region Helpers + + internal static new JsonObject FromObject(object instance) => + (JsonObject)new JsonSerializer().Serialize(instance); + + #endregion + + #region Static Constructors + + internal static JsonObject FromStream(Stream stream) + { + using (var tr = new StreamReader(stream)) + { + return (JsonObject)Parse(tr); + } + } + + internal static new JsonObject Parse(string text) + { + return (JsonObject)JsonNode.Parse(text); + } + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonString.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonString.cs new file mode 100644 index 00000000000..03911a84401 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/JsonString.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed partial class JsonString : JsonNode, IEquatable + { + private readonly string value; + + internal JsonString(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal override JsonType Type => JsonType.String; + + internal string Value => value; + + internal int Length => value.Length; + + #region #region Implicit Casts + + public static implicit operator string(JsonString data) => data.Value; + + public static implicit operator JsonString(string value) => new JsonString(value); + + #endregion + + public override int GetHashCode() => value.GetHashCode(); + + public override string ToString() => value; + + #region IEquatable + + bool IEquatable.Equals(JsonString other) => this.Value == other.Value; + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/XBinary.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/XBinary.cs new file mode 100644 index 00000000000..2307177bf67 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/XBinary.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal sealed class XBinary : JsonNode + { + private readonly byte[] _value; + private readonly string _base64; + + internal XBinary(byte[] value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal XBinary(string base64EncodedString) + { + _base64 = base64EncodedString ?? throw new ArgumentNullException(nameof(base64EncodedString)); + } + + internal override JsonType Type => JsonType.Binary; + + internal byte[] Value => _value ?? Convert.FromBase64String(_base64); + + #region #region Implicit Casts + + public static implicit operator byte[] (XBinary data) => data.Value; + + public static implicit operator XBinary(byte[] data) => new XBinary(data); + + #endregion + + public override int GetHashCode() => Value.GetHashCode(); + + public override string ToString() => _base64 ?? Convert.ToBase64String(_value); + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/XNull.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/XNull.cs new file mode 100644 index 00000000000..d1fee277295 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Nodes/XNull.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + internal sealed class XNull : JsonNode + { + internal static readonly XNull Instance = new XNull(); + + private XNull() { } + + internal override JsonType Type => JsonType.Null; + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/Exceptions/ParseException.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/Exceptions/ParseException.cs new file mode 100644 index 00000000000..a0ef8a84b8e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/Exceptions/ParseException.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal class ParserException : Exception + { + internal ParserException(string message) + : base(message) + { } + + internal ParserException(string message, SourceLocation location) + : base(message) + { + + Location = location; + } + + internal SourceLocation Location { get; } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/JsonParser.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/JsonParser.cs new file mode 100644 index 00000000000..a84d6e07448 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/JsonParser.cs @@ -0,0 +1,180 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public class JsonParser : IDisposable + { + private readonly TokenReader reader; + + internal JsonParser(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonParser(SourceReader sourceReader) + { + if (sourceReader == null) + throw new ArgumentNullException(nameof(sourceReader)); + + this.reader = new TokenReader(new JsonTokenizer(sourceReader)); + + this.reader.Next(); // Start with the first token + } + + internal IEnumerable ReadNodes() + { + JsonNode node; + + while ((node = ReadNode()) != null) yield return node; + } + + internal JsonNode ReadNode() + { + if (reader.Current.Kind == TokenKind.Eof || reader.Current.IsTerminator) + { + return null; + } + + switch (reader.Current.Kind) + { + case TokenKind.LeftBrace : return ReadObject(); // { + case TokenKind.LeftBracket : return ReadArray(); // [ + + default: throw new ParserException($"Expected '{{' or '['. Was {reader.Current}."); + } + } + + private JsonNode ReadFieldValue() + { + // Boolean, Date, Null, Number, String, Uri + if (reader.Current.IsLiteral) + { + return ReadLiteral(); + } + else + { + switch (reader.Current.Kind) + { + case TokenKind.LeftBracket: return ReadArray(); + case TokenKind.LeftBrace : return ReadObject(); + + default: throw new ParserException($"Unexpected token reading field value. Was {reader.Current}."); + } + } + } + + private JsonNode ReadLiteral() + { + var literal = reader.Current; + + reader.Next(); // Read the literal token + + switch (literal.Kind) + { + case TokenKind.Boolean : return JsonBoolean.Parse(literal.Value); + case TokenKind.Null : return XNull.Instance; + case TokenKind.Number : return new JsonNumber(literal.Value); + case TokenKind.String : return new JsonString(literal.Value); + + default: throw new ParserException($"Unexpected token reading literal. Was {literal}."); + } + } + + internal JsonObject ReadObject() + { + reader.Ensure(TokenKind.LeftBrace, "object"); + + reader.Next(); // Read '{' (Object start) + + var jsonObject = new JsonObject(); + + // Read the object's fields until we reach the end of the object ('}') + while (reader.Current.Kind != TokenKind.RightBrace) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read ',' (Seperator) + } + + // Ensure we have a field name + reader.Ensure(TokenKind.String, "Expected field name"); + + var field = ReadField(); + + jsonObject.Add(field.Key, field.Value); + } + + reader.Next(); // Read '}' (Object end) + + return jsonObject; + } + + + // TODO: Use ValueTuple in C#7 + private KeyValuePair ReadField() + { + var fieldName = reader.Current.Value; + + reader.Next(); // Read the field name + + reader.Ensure(TokenKind.Colon, "field"); + + reader.Next(); // Read ':' (Field value indicator) + + return new KeyValuePair(fieldName, ReadFieldValue()); + } + + + internal JsonArray ReadArray() + { + reader.Ensure(TokenKind.LeftBracket, "array"); + + var array = new XNodeArray(); + + reader.Next(); // Read the '[' (Array start) + + // Read the array's items + while (reader.Current.Kind != TokenKind.RightBracket) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read the ',' (Seperator) + } + + if (reader.Current.IsLiteral) + { + array.Add(ReadLiteral()); // Boolean, Date, Number, Null, String, Uri + } + else if (reader.Current.Kind == TokenKind.LeftBracket) + { + array.Add(ReadArray()); // Array + } + else if (reader.Current.Kind == TokenKind.LeftBrace) + { + array.Add(ReadObject()); // Object + } + else + { + throw new ParserException($"Expected comma, literal, or object. Was {reader.Current}."); + } + } + + reader.Next(); // Read the ']' (Array end) + + return array; + } + + #region IDisposable + + public void Dispose() + { + reader.Dispose(); + } + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/JsonToken.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/JsonToken.cs new file mode 100644 index 00000000000..f3be91265c7 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/JsonToken.cs @@ -0,0 +1,66 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + internal enum TokenKind + { + LeftBrace, // { Object start + RightBrace, // } Object end + + LeftBracket, // [ Array start + RightBracket, // ] Array end + + Comma, // , Comma + Colon, // : Value indicator + Dot, // . Access field indicator + Terminator, // \0 Stream terminator + + Boolean = 31, // true or false + Null = 33, // null + Number = 34, // i.e. -1.93, -1, 0, 1, 1.1 + String = 35, // i.e. "text" + + Eof = 50 + } + + internal /* readonly */ struct JsonToken + { + internal static readonly JsonToken BraceOpen = new JsonToken(TokenKind.LeftBrace, "{"); + internal static readonly JsonToken BraceClose = new JsonToken(TokenKind.RightBrace, "}"); + + internal static readonly JsonToken BracketOpen = new JsonToken(TokenKind.LeftBracket, "["); + internal static readonly JsonToken BracketClose = new JsonToken(TokenKind.RightBracket, "]"); + + internal static readonly JsonToken Colon = new JsonToken(TokenKind.Colon, ":"); + internal static readonly JsonToken Comma = new JsonToken(TokenKind.Comma, ","); + internal static readonly JsonToken Terminator = new JsonToken(TokenKind.Terminator, "\0"); + + internal static readonly JsonToken True = new JsonToken(TokenKind.Boolean, "true"); + internal static readonly JsonToken False = new JsonToken(TokenKind.Boolean, "false"); + internal static readonly JsonToken Null = new JsonToken(TokenKind.Null, "null"); + + internal static readonly JsonToken Eof = new JsonToken(TokenKind.Eof, null); + + internal JsonToken(TokenKind kind, string value) + { + Kind = kind; + Value = value; + } + + internal readonly TokenKind Kind; + + internal readonly string Value; + + public override string ToString() => Kind + ": " + Value; + + #region Helpers + + internal bool IsLiteral => (byte)Kind > 30 && (byte)Kind < 40; + + internal bool IsTerminator => Kind == TokenKind.Terminator; + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/JsonTokenizer.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/JsonTokenizer.cs new file mode 100644 index 00000000000..968ee15e3e6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/JsonTokenizer.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * 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.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + using System.IO; + + + public class JsonTokenizer : IDisposable + { + private readonly StringBuilder sb = new StringBuilder(); + + private readonly SourceReader reader; + + internal JsonTokenizer(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonTokenizer(SourceReader reader) + { + this.reader = reader; + + reader.Next(); // Start with the first char + } + + internal JsonToken ReadNext() + { + reader.SkipWhitespace(); + + if (reader.IsEof) return JsonToken.Eof; + + switch (reader.Current) + { + case '"': return ReadQuotedString(); + + // Symbols + case '[' : reader.Next(); return JsonToken.BracketOpen; // Array start + case ']' : reader.Next(); return JsonToken.BracketClose; // Array end + case ',' : reader.Next(); return JsonToken.Comma; // Value seperator + case ':' : reader.Next(); return JsonToken.Colon; // Field value indicator + case '{' : reader.Next(); return JsonToken.BraceOpen; // Object start + case '}' : reader.Next(); return JsonToken.BraceClose; // Object end + case '\0' : reader.Next(); return JsonToken.Terminator; // Stream terminiator + + default: return ReadLiteral(); + } + } + + private JsonToken ReadQuotedString() + { + Expect('"', "quoted string indicator"); + + reader.Next(); // Read '"' (Starting quote) + + // Read until we reach an unescaped quote char + while (reader.Current != '"') + { + EnsureNotEof("quoted string"); + + if (reader.Current == '\\') + { + char escapedCharacter = reader.ReadEscapeCode(); + + sb.Append(escapedCharacter); + + continue; + } + + StoreCurrentCharacterAndReadNext(); + } + + reader.Next(); // Read '"' (Ending quote) + + return new JsonToken(TokenKind.String, value: sb.Extract()); + } + + private JsonToken ReadLiteral() + { + if (char.IsDigit(reader.Current) || + reader.Current == '-' || + reader.Current == '+') + { + return ReadNumber(); + } + + return ReadIdentifer(); + } + + private JsonToken ReadNumber() + { + // Read until we hit a non-numeric character + // -6.247737e-06 + // E + + while (char.IsDigit(reader.Current) + || reader.Current == '.' + || reader.Current == 'e' + || reader.Current == 'E' + || reader.Current == '-' + || reader.Current == '+') + { + StoreCurrentCharacterAndReadNext(); + } + + return new JsonToken(TokenKind.Number, value: sb.Extract()); + } + + int count = 0; + + private JsonToken ReadIdentifer() + { + count++; + + if (!char.IsLetter(reader.Current)) + { + throw new ParserException( + message : $"Expected literal (number, boolean, or null). Was '{reader.Current}'.", + location : reader.Location + ); + } + + // Read letters, numbers, and underscores '_' + while (char.IsLetterOrDigit(reader.Current) || reader.Current == '_') + { + StoreCurrentCharacterAndReadNext(); + } + + string text = sb.Extract(); + + switch (text) + { + case "true": return JsonToken.True; + case "false": return JsonToken.False; + case "null": return JsonToken.Null; + + default: return new JsonToken(TokenKind.String, text); + } + } + + private void Expect(char character, string description) + { + if (reader.Current != character) + { + throw new ParserException( + message: $"Expected {description} ('{character}'). Was '{reader.Current}'.", + location: reader.Location + ); + } + } + + private void EnsureNotEof(string tokenType) + { + if (reader.IsEof) + { + throw new ParserException( + message: $"Unexpected EOF while reading {tokenType}.", + location: reader.Location + ); + } + } + + private void StoreCurrentCharacterAndReadNext() + { + sb.Append(reader.Current); + + reader.Next(); + } + + public void Dispose() + { + reader.Dispose(); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/Location.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/Location.cs new file mode 100644 index 00000000000..0dfaa42e39c --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/Location.cs @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime.Json +{ + internal struct SourceLocation + { + private int line; + private int column; + private int position; + + internal SourceLocation(int line = 0, int column = 0, int position = 0) + { + this.line = line; + this.column = column; + this.position = position; + } + + internal int Line => line; + + internal int Column => column; + + internal int Position => position; + + internal void Advance() + { + this.column++; + this.position++; + } + + internal void MarkNewLine() + { + this.line++; + this.column = 0; + } + + internal SourceLocation Clone() + { + return new SourceLocation(line, column, position); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/Readers/SourceReader.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/Readers/SourceReader.cs new file mode 100644 index 00000000000..14a698754d1 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/Readers/SourceReader.cs @@ -0,0 +1,130 @@ +/*--------------------------------------------------------------------------------------------- + * 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.Globalization; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public sealed class SourceReader : IDisposable + { + private readonly TextReader source; + + private char current; + + private readonly SourceLocation location = new SourceLocation(); + + private bool isEof = false; + + internal SourceReader(TextReader textReader) + { + this.source = textReader ?? throw new ArgumentNullException(nameof(textReader)); + } + + /// + /// Advances to the next character + /// + internal void Next() + { + // Advance to the new line when we see a new line '\n'. + // A new line may be prefixed by a carriage return '\r'. + + if (current == '\n') + { + location.MarkNewLine(); + } + + int charCode = source.Read(); // -1 for end + + if (charCode >= 0) + { + current = (char)charCode; + } + else + { + // If we've already marked this as the EOF, throw an exception + if (isEof) + { + throw new EndOfStreamException("Cannot advance past end of stream."); + } + + isEof = true; + + current = '\0'; + } + + location.Advance(); + } + + internal void SkipWhitespace() + { + while (char.IsWhiteSpace(current)) + { + Next(); + } + } + + internal char ReadEscapeCode() + { + Next(); + + char escapedChar = current; + + Next(); // Consume escaped character + + switch (escapedChar) + { + // Special escape codes + case '"': return '"'; // " (Quotation mark) U+0022 + case '/': return '/'; // / (Solidus) U+002F + case '\\': return '\\'; // \ (Reverse solidus) U+005C + + // Control Characters + case '0': return '\0'; // Nul (0) U+0000 + case 'a': return '\a'; // Alert (7) + case 'b': return '\b'; // Backspace (8) U+0008 + case 'f': return '\f'; // Form feed (12) U+000C + case 'n': return '\n'; // Line feed (10) U+000A + case 'r': return '\r'; // Carriage return (13) U+000D + case 't': return '\t'; // Horizontal tab (9) U+0009 + case 'v': return '\v'; // Vertical tab + + // Unicode escape sequence + case 'u': return ReadUnicodeEscapeSequence(); // U+XXXX + + default: throw new Exception($"Unrecognized escape sequence '\\{escapedChar}'"); + } + } + + private readonly char[] hexCode = new char[4]; + + private char ReadUnicodeEscapeSequence() + { + hexCode[0] = current; Next(); + hexCode[1] = current; Next(); + hexCode[2] = current; Next(); + hexCode[3] = current; Next(); + + return Convert.ToChar(int.Parse( + s : new string(hexCode), + style : NumberStyles.HexNumber, + provider: NumberFormatInfo.InvariantInfo + )); + } + + internal char Current => current; + + internal bool IsEof => isEof; + + internal char Peek() => (char)source.Peek(); + + internal SourceLocation Location => location; + + public void Dispose() + { + source.Dispose(); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/TokenReader.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/TokenReader.cs new file mode 100644 index 00000000000..16293bbd855 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Parser/TokenReader.cs @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + public class TokenReader : IDisposable + { + private readonly JsonTokenizer tokenizer; + private JsonToken current; + + internal TokenReader(JsonTokenizer tokenizer) + { + this.tokenizer = tokenizer ?? throw new ArgumentNullException(nameof(tokenizer)); + } + + internal void Next() + { + current = tokenizer.ReadNext(); + } + + internal JsonToken Current => current; + + internal void Ensure(TokenKind kind, string readerName) + { + if (current.Kind != kind) + { + throw new ParserException($"Expected {kind} while reading {readerName}). Was {current}."); + } + } + + public void Dispose() + { + tokenizer.Dispose(); + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/PipelineMocking.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/PipelineMocking.cs new file mode 100644 index 00000000000..5b986c8f7fc --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/PipelineMocking.cs @@ -0,0 +1,262 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + using System.Threading.Tasks; + using System.Collections.Generic; + using System.Net.Http; + using System.Linq; + using System.Net; + using Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json; + + public enum MockMode + { + Live, + Record, + Playback, + + } + + public class PipelineMock + { + + private System.Collections.Generic.Stack scenario = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack context = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack description = new System.Collections.Generic.Stack(); + + private readonly string recordingPath; + private int counter = 0; + + public static implicit operator Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.SendAsyncStep(PipelineMock instance) => instance.SendAsync; + + public MockMode Mode { get; set; } = MockMode.Live; + public PipelineMock(string recordingPath) + { + this.recordingPath = recordingPath; + } + + public void PushContext(string text) => context.Push(text); + + public void PushDescription(string text) => description.Push(text); + + + public void PushScenario(string it) + { + // reset counter too + counter = 0; + + scenario.Push(it); + } + + public void PopContext() => context.Pop(); + + public void PopDescription() => description.Pop(); + + public void PopScenario() => scenario.Pop(); + + public void SetRecord() => Mode = MockMode.Record; + + public void SetPlayback() => Mode = MockMode.Playback; + + public void SetLive() => Mode = MockMode.Live; + + public string Scenario => (scenario.Count > 0 ? scenario.Peek() : "[NoScenario]"); + public string Description => (description.Count > 0 ? description.Peek() : "[NoDescription]"); + public string Context => (context.Count > 0 ? context.Peek() : "[NoContext]"); + + /// + /// Headers that we substitute out blank values for in the recordings + /// Add additional headers as necessary + /// + public static HashSet Blacklist = new HashSet(System.StringComparer.CurrentCultureIgnoreCase) { + "Authorization", + }; + + public Dictionary ForceResponseHeaders = new Dictionary(); + + internal static XImmutableArray Removed = new XImmutableArray(new string[] { "[Filtered]" }); + + internal static IEnumerable> FilterHeaders(IEnumerable>> headers) => headers.Select(header => new KeyValuePair(header.Key, Blacklist.Contains(header.Key) ? Removed : new XImmutableArray(header.Value.ToArray()))); + + internal static JsonNode SerializeContent(HttpContent content, ref bool isBase64) => content == null ? XNull.Instance : SerializeContent(content.ReadAsByteArrayAsync().Result, ref isBase64); + + internal static JsonNode SerializeContent(byte[] content, ref bool isBase64) + { + if (null == content || content.Length == 0) + { + return XNull.Instance; + } + var first = content[0]; + var last = content[content.Length - 1]; + + // plaintext for JSON/SGML/XML/HTML/STRINGS/ARRAYS + if ((first == '{' && last == '}') || (first == '<' && last == '>') || (first == '[' && last == ']') || (first == '"' && last == '"')) + { + return new JsonString(System.Text.Encoding.UTF8.GetString(content)); + } + + // base64 for everyone else + return new JsonString(System.Convert.ToBase64String(content)); + } + + internal static byte[] DeserializeContent(string content, bool isBase64) + { + if (string.IsNullOrWhiteSpace(content)) + { + return new byte[0]; + } + + if (isBase64) + { + try + { + return System.Convert.FromBase64String(content); + } + catch + { + // hmm. didn't work, return it as a string I guess. + } + } + return System.Text.Encoding.UTF8.GetBytes(content); + } + + public void SaveMessage(string rqKey, HttpRequestMessage request, HttpResponseMessage response) + { + var messages = System.IO.File.Exists(this.recordingPath) ? Load() : new JsonObject() ?? new JsonObject(); + bool isBase64Request = false; + bool isBase64Response = false; + messages[rqKey] = new JsonObject { + { "Request",new JsonObject { + { "Method", request.Method.Method }, + { "RequestUri", request.RequestUri }, + { "Content", SerializeContent( request.Content, ref isBase64Request) }, + { "isContentBase64", isBase64Request }, + { "Headers", new JsonObject(FilterHeaders(request.Headers)) }, + { "ContentHeaders", request.Content == null ? new JsonObject() : new JsonObject(FilterHeaders(request.Content.Headers))} + } }, + {"Response", new JsonObject { + { "StatusCode", (int)response.StatusCode}, + { "Headers", new JsonObject(FilterHeaders(response.Headers))}, + { "ContentHeaders", new JsonObject(FilterHeaders(response.Content.Headers))}, + { "Content", SerializeContent(response.Content, ref isBase64Response) }, + { "isContentBase64", isBase64Response }, + }} + }; + System.IO.File.WriteAllText(this.recordingPath, messages.ToString()); + } + + private JsonObject Load() + { + if (System.IO.File.Exists(this.recordingPath)) + { + try + { + return JsonObject.FromStream(System.IO.File.OpenRead(this.recordingPath)); + } + catch + { + throw new System.Exception($"Invalid recording file: '{recordingPath}'"); + } + } + + throw new System.ArgumentException($"Missing recording file: '{recordingPath}'", nameof(recordingPath)); + } + + public HttpResponseMessage LoadMessage(string rqKey) + { + var responses = Load(); + var message = responses.Property(rqKey); + + if (null == message) + { + throw new System.ArgumentException($"Missing Request '{rqKey}' in recording file", nameof(rqKey)); + } + + var sc = 0; + var reqMessage = message.Property("Request"); + var respMessage = message.Property("Response"); + + // --------------------------- deserialize response ---------------------------------------------------------------- + bool isBase64Response = false; + respMessage.BooleanProperty("isContentBase64", ref isBase64Response); + var response = new HttpResponseMessage + { + StatusCode = (HttpStatusCode)respMessage.NumberProperty("StatusCode", ref sc), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(respMessage.StringProperty("Content"), isBase64Response)) + }; + + foreach (var each in respMessage.Property("Headers")) + { + response.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + foreach (var frh in ForceResponseHeaders) + { + response.Headers.Remove(frh.Key); + response.Headers.TryAddWithoutValidation(frh.Key, frh.Value); + } + + foreach (var each in respMessage.Property("ContentHeaders")) + { + response.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + // --------------------------- deserialize request ---------------------------------------------------------------- + bool isBase64Request = false; + reqMessage.BooleanProperty("isContentBase64", ref isBase64Request); + response.RequestMessage = new HttpRequestMessage + { + Method = new HttpMethod(reqMessage.StringProperty("Method")), + RequestUri = new System.Uri(reqMessage.StringProperty("RequestUri")), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(reqMessage.StringProperty("Content"), isBase64Request)) + }; + + foreach (var each in reqMessage.Property("Headers")) + { + response.RequestMessage.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + foreach (var each in reqMessage.Property("ContentHeaders")) + { + response.RequestMessage.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + return response; + } + + public async Task SendAsync(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + counter++; + var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri}+{counter}"; + + switch (Mode) + { + case MockMode.Record: + //Add following code since the request.Content will be released after sendAsync + var requestClone = request; + if (requestClone.Content != null) + { + requestClone = await request.CloneWithContent(request.RequestUri, request.Method); + } + // make the call + var response = await next.SendAsync(request, callback); + + // save the message to the recording file + SaveMessage(rqkey, requestClone, response); + + // return the response. + return response; + + case MockMode.Playback: + // load and return the response. + return LoadMessage(rqkey); + + default: + // pass-thru, do nothing + return await next.SendAsync(request, callback); + } + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Properties/Resources.Designer.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Properties/Resources.Designer.cs new file mode 100644 index 00000000000..9012de0fa67 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Properties/Resources.Designer.cs @@ -0,0 +1,5655 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.generated.runtime.Properties +{ + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager + { + get + { + if (object.ReferenceEquals(resourceMan, null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.PowerShell.Cmdlets.DataBox.generated.runtime.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to The remote server returned an error: (401) Unauthorized.. + /// + public static string AccessDeniedExceptionMessage + { + get + { + return ResourceManager.GetString("AccessDeniedExceptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account id doesn't match one in subscription.. + /// + public static string AccountIdDoesntMatchSubscription + { + get + { + return ResourceManager.GetString("AccountIdDoesntMatchSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account needs to be specified. + /// + public static string AccountNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("AccountNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account "{0}" has been added.. + /// + public static string AddAccountAdded + { + get + { + return ResourceManager.GetString("AddAccountAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To switch to a different subscription, please use Select-AzureSubscription.. + /// + public static string AddAccountChangeSubscription + { + get + { + return ResourceManager.GetString("AddAccountChangeSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Skipping external tenant {0}, because you are using a guest or a foreign principal object identity. In order to access this tenant, please run Add-AzureAccount without "-Credential".. + /// + public static string AddAccountNonInteractiveGuestOrFpo + { + get + { + return ResourceManager.GetString("AddAccountNonInteractiveGuestOrFpo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription "{0}" is selected as the default subscription.. + /// + public static string AddAccountShowDefaultSubscription + { + get + { + return ResourceManager.GetString("AddAccountShowDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To view all the subscriptions, please use Get-AzureSubscription.. + /// + public static string AddAccountViewSubscriptions + { + get + { + return ResourceManager.GetString("AddAccountViewSubscriptions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} is created successfully.. + /// + public static string AddOnCreatedMessage + { + get + { + return ResourceManager.GetString("AddOnCreatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-on name {0} is already used.. + /// + public static string AddOnNameAlreadyUsed + { + get + { + return ResourceManager.GetString("AddOnNameAlreadyUsed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} not found.. + /// + public static string AddOnNotFound + { + get + { + return ResourceManager.GetString("AddOnNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-on {0} is removed successfully.. + /// + public static string AddOnRemovedMessage + { + get + { + return ResourceManager.GetString("AddOnRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} is updated successfully.. + /// + public static string AddOnUpdatedMessage + { + get + { + return ResourceManager.GetString("AddOnUpdatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}.. + /// + public static string AddRoleMessageCreate + { + get + { + return ResourceManager.GetString("AddRoleMessageCreate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for Node.js by running ‘npm install azure’.. + /// + public static string AddRoleMessageCreateNode + { + get + { + return ResourceManager.GetString("AddRoleMessageCreateNode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for PHP by running "pear WindowsAzure/WindowsAzure".. + /// + public static string AddRoleMessageCreatePHP + { + get + { + return ResourceManager.GetString("AddRoleMessageCreatePHP", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to set role permissions. Please give the 'Network Service' user 'Read & execute' and 'Modify' permissions to the role folder, or run PowerShell as an Administrator. + /// + public static string AddRoleMessageInsufficientPermissions + { + get + { + return ResourceManager.GetString("AddRoleMessageInsufficientPermissions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A role name '{0}' already exists. + /// + public static string AddRoleMessageRoleExists + { + get + { + return ResourceManager.GetString("AddRoleMessageRoleExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Profile {0} already has an endpoint with name {1}. + /// + public static string AddTrafficManagerEndpointFailed + { + get + { + return ResourceManager.GetString("AddTrafficManagerEndpointFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure PowerShell collects usage data in order to improve your experience. + ///The data is anonymous and does not include commandline argument values. + ///The data is collected by Microsoft. + /// + ///Use the Disable-AzDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Az.Accounts module. To disable data collection: PS > Disable-AzDataCollection. + ///Use the Enable-AzDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Az.Accounts module. To enable [rest of string was truncated]";. + /// + public static string ARMDataCollectionMessage + { + get + { + return ResourceManager.GetString("ARMDataCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Authenticating for account {0} with single tenant {1}.. + /// + public static string AuthenticatingForSingleTenant + { + get + { + return ResourceManager.GetString("AuthenticatingForSingleTenant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Windows Azure Powershell\. + /// + public static string AzureDirectory + { + get + { + return ResourceManager.GetString("AzureDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://manage.windowsazure.com. + /// + public static string AzurePortalUrl + { + get + { + return ResourceManager.GetString("AzurePortalUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_PORTAL_URL. + /// + public static string AzurePortalUrlEnv + { + get + { + return ResourceManager.GetString("AzurePortalUrlEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Selected profile must not be null.. + /// + public static string AzureProfileMustNotBeNull + { + get + { + return ResourceManager.GetString("AzureProfileMustNotBeNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure SDK\{0}\. + /// + public static string AzureSdkDirectory + { + get + { + return ResourceManager.GetString("AzureSdkDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File '{0}' already exists. Use the -Force parameter to overwrite it.. + /// + public static string AzureVMDscArchiveAlreadyExists + { + get + { + return ResourceManager.GetString("AzureVMDscArchiveAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find configuration data file: {0}. + /// + public static string AzureVMDscCannotFindConfigurationDataFile + { + get + { + return ResourceManager.GetString("AzureVMDscCannotFindConfigurationDataFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Create Archive. + /// + public static string AzureVMDscCreateArchiveAction + { + get + { + return ResourceManager.GetString("AzureVMDscCreateArchiveAction", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The configuration data must be a .psd1 file. + /// + public static string AzureVMDscInvalidConfigurationDataFile + { + get + { + return ResourceManager.GetString("AzureVMDscInvalidConfigurationDataFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Parsing configuration script: {0}. + /// + public static string AzureVMDscParsingConfiguration + { + get + { + return ResourceManager.GetString("AzureVMDscParsingConfiguration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Storage Blob '{0}' already exists. Use the -Force parameter to overwrite it.. + /// + public static string AzureVMDscStorageBlobAlreadyExists + { + get + { + return ResourceManager.GetString("AzureVMDscStorageBlobAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Upload '{0}'. + /// + public static string AzureVMDscUploadToBlobStorageAction + { + get + { + return ResourceManager.GetString("AzureVMDscUploadToBlobStorageAction", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Execution failed because a background thread could not prompt the user.. + /// + public static string BaseShouldMethodFailureReason + { + get + { + return ResourceManager.GetString("BaseShouldMethodFailureReason", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Base Uri was empty.. + /// + public static string BaseUriEmpty + { + get + { + return ResourceManager.GetString("BaseUriEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} begin processing without ParameterSet.. + /// + public static string BeginProcessingWithoutParameterSetLog + { + get + { + return ResourceManager.GetString("BeginProcessingWithoutParameterSetLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} begin processing with ParameterSet '{1}'.. + /// + public static string BeginProcessingWithParameterSetLog + { + get + { + return ResourceManager.GetString("BeginProcessingWithParameterSetLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Blob with the name {0} already exists in the account.. + /// + public static string BlobAlreadyExistsInTheAccount + { + get + { + return ResourceManager.GetString("BlobAlreadyExistsInTheAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://{0}.blob.core.windows.net/. + /// + public static string BlobEndpointUri + { + get + { + return ResourceManager.GetString("BlobEndpointUri", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_BLOBSTORAGE_TEMPLATE. + /// + public static string BlobEndpointUriEnv + { + get + { + return ResourceManager.GetString("BlobEndpointUriEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is changing.. + /// + public static string BreakingChangeAttributeParameterChanging + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterChanging", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is becoming mandatory.. + /// + public static string BreakingChangeAttributeParameterMandatoryNow + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterMandatoryNow", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is being replaced by parameter : '{1}'.. + /// + public static string BreakingChangeAttributeParameterReplaced + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterReplaced", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is being replaced by mandatory parameter : '{1}'.. + /// + public static string BreakingChangeAttributeParameterReplacedMandatory + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterReplacedMandatory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The type of the parameter is changing from '{0}' to '{1}'.. + /// + public static string BreakingChangeAttributeParameterTypeChange + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterTypeChange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Change description : {0} + ///. + /// + public static string BreakingChangesAttributesChangeDescriptionMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesChangeDescriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet is being deprecated. There will be no replacement for it.. + /// + public static string BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet is being deprecated. There will be no replacement for it.. + /// + public static string BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet '{0}' is replacing this cmdlet.. + /// + public static string BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The output type is changing from the existing type :'{0}' to the new type :'{1}'. + /// + public static string BreakingChangesAttributesCmdLetOutputChange1 + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputChange1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "The output type '{0}' is changing". + /// + public static string BreakingChangesAttributesCmdLetOutputChange2 + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputChange2", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to + ///- The following properties are being added to the output type : + ///. + /// + public static string BreakingChangesAttributesCmdLetOutputPropertiesAdded + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputPropertiesAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to + /// - The following properties in the output type are being deprecated : + ///. + /// + public static string BreakingChangesAttributesCmdLetOutputPropertiesRemoved + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputPropertiesRemoved", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The output type '{0}' is being deprecated without a replacement.. + /// + public static string BreakingChangesAttributesCmdLetOutputTypeDeprecated + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputTypeDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to - {0} + /// + ///. + /// + public static string BreakingChangesAttributesDeclarationMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesDeclarationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to - Cmdlet : '{0}' + /// - {1} + ///. + /// + public static string BreakingChangesAttributesDeclarationMessageWithCmdletName + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesDeclarationMessageWithCmdletName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to NOTE : Go to {0} for steps to suppress (and other related information on) the breaking change messages.. + /// + public static string BreakingChangesAttributesFooterMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesFooterMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Breaking changes in the cmdlet '{0}' :. + /// + public static string BreakingChangesAttributesHeaderMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesHeaderMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note : This change will take effect on '{0}' + ///. + /// + public static string BreakingChangesAttributesInEffectByDateMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByDateMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note :The change is expected to take effect from version : '{0}' + /// + ///. + /// + public static string BreakingChangesAttributesInEffectByVersion + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note :The change is expected to take effect from az version : '{0}' + /// + ///. + /// + public static string BreakingChangesAttributesInEffectByAzVersion + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByAzVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ```powershell + ///# Old + ///{0} + /// + ///# New + ///{1} + ///``` + /// + ///. + /// + public static string BreakingChangesAttributesUsageChangeMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesUsageChangeMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cmdlet invocation changes : + /// Old Way : {0} + /// New Way : {1}. + /// + public static string BreakingChangesAttributesUsageChangeMessageConsole + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesUsageChangeMessageConsole", resourceCulture); + } + } + + /// + /// The cmdlet is in experimental stage. The function may not be enabled in current subscription. + /// + public static string ExperimentalCmdletMessage + { + get + { + return ResourceManager.GetString("ExperimentalCmdletMessage", resourceCulture); + } + } + + + + /// + /// Looks up a localized string similar to CACHERUNTIMEURL. + /// + public static string CacheRuntimeUrl + { + get + { + return ResourceManager.GetString("CacheRuntimeUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to cache. + /// + public static string CacheRuntimeValue + { + get + { + return ResourceManager.GetString("CacheRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CacheRuntimeVersion. + /// + public static string CacheRuntimeVersionKey + { + get + { + return ResourceManager.GetString("CacheRuntimeVersionKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing caching version {0} for Role '{1}' (the caching version locally installed is: {2}). + /// + public static string CacheVersionWarningText + { + get + { + return ResourceManager.GetString("CacheVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot change built-in environment {0}.. + /// + public static string CannotChangeBuiltinEnvironment + { + get + { + return ResourceManager.GetString("CannotChangeBuiltinEnvironment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find {0} with name {1}.. + /// + public static string CannotFind + { + get + { + return ResourceManager.GetString("CannotFind", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deployment for service {0} with {1} slot doesn't exist. + /// + public static string CannotFindDeployment + { + get + { + return ResourceManager.GetString("CannotFindDeployment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Can't find valid Microsoft Azure role in current directory {0}. + /// + public static string CannotFindRole + { + get + { + return ResourceManager.GetString("CannotFindRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service {0} configuration file (ServiceConfiguration.Cloud.cscfg) is either null or doesn't exist. + /// + public static string CannotFindServiceConfigurationFile + { + get + { + return ResourceManager.GetString("CannotFindServiceConfigurationFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid service path! Cannot locate ServiceDefinition.csdef in current folder or parent folders.. + /// + public static string CannotFindServiceRoot + { + get + { + return ResourceManager.GetString("CannotFindServiceRoot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named {0} with id {1} is not currently imported. You must import this subscription before it can be updated.. + /// + public static string CannotUpdateUnknownSubscription + { + get + { + return ResourceManager.GetString("CannotUpdateUnknownSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ManagementCertificate. + /// + public static string CertificateElementName + { + get + { + return ResourceManager.GetString("CertificateElementName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to certificate.pfx. + /// + public static string CertificateFileName + { + get + { + return ResourceManager.GetString("CertificateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Certificate imported into CurrentUser\My\{0}. + /// + public static string CertificateImportedMessage + { + get + { + return ResourceManager.GetString("CertificateImportedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No certificate was found in the certificate store with thumbprint {0}. + /// + public static string CertificateNotFoundInStore + { + get + { + return ResourceManager.GetString("CertificateNotFoundInStore", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your account does not have access to the private key for certificate {0}. + /// + public static string CertificatePrivateKeyAccessError + { + get + { + return ResourceManager.GetString("CertificatePrivateKeyAccessError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} {1} deployment for {2} service. + /// + public static string ChangeDeploymentStateWaitMessage + { + get + { + return ResourceManager.GetString("ChangeDeploymentStateWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cloud service {0} is in {1} state.. + /// + public static string ChangeDeploymentStatusCompleteMessage + { + get + { + return ResourceManager.GetString("ChangeDeploymentStatusCompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Changing/Removing public environment '{0}' is not allowed.. + /// + public static string ChangePublicEnvironmentMessage + { + get + { + return ResourceManager.GetString("ChangePublicEnvironmentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} is set to value {1}. + /// + public static string ChangeSettingsElementMessage + { + get + { + return ResourceManager.GetString("ChangeSettingsElementMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Changing public environment is not supported.. + /// + public static string ChangingDefaultEnvironmentNotSupported + { + get + { + return ResourceManager.GetString("ChangingDefaultEnvironmentNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose which publish settings file to use:. + /// + public static string ChoosePublishSettingsFile + { + get + { + return ResourceManager.GetString("ChoosePublishSettingsFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel. + /// + public static string ClientDiagnosticLevelName + { + get + { + return ResourceManager.GetString("ClientDiagnosticLevelName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1. + /// + public static string ClientDiagnosticLevelValue + { + get + { + return ResourceManager.GetString("ClientDiagnosticLevelValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to cloud_package.cspkg. + /// + public static string CloudPackageFileName + { + get + { + return ResourceManager.GetString("CloudPackageFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceConfiguration.Cloud.cscfg. + /// + public static string CloudServiceConfigurationFileName + { + get + { + return ResourceManager.GetString("CloudServiceConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-ons for {0}. + /// + public static string CloudServiceDescription + { + get + { + return ResourceManager.GetString("CloudServiceDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Communication could not be established. This could be due to an invalid subscription ID. Note that subscription IDs are case sensitive.. + /// + public static string CommunicationCouldNotBeEstablished + { + get + { + return ResourceManager.GetString("CommunicationCouldNotBeEstablished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Complete. + /// + public static string CompleteMessage + { + get + { + return ResourceManager.GetString("CompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to OperationID : '{0}'. + /// + public static string ComputeCloudExceptionOperationIdMessage + { + get + { + return ResourceManager.GetString("ComputeCloudExceptionOperationIdMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to config.json. + /// + public static string ConfigurationFileName + { + get + { + return ResourceManager.GetString("ConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to VirtualMachine creation failed.. + /// + public static string CreateFailedErrorMessage + { + get + { + return ResourceManager.GetString("CreateFailedErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating the website failed. If this is the first website for this subscription, please create it using the management portal instead.. + /// + public static string CreateWebsiteFailed + { + get + { + return ResourceManager.GetString("CreateWebsiteFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core. + /// + public static string DataCacheClientsType + { + get + { + return ResourceManager.GetString("DataCacheClientsType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to //blobcontainer[@datacenter='{0}']. + /// + public static string DatacenterBlobQuery + { + get + { + return ResourceManager.GetString("DatacenterBlobQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft Azure PowerShell Data Collection Confirmation. + /// + public static string DataCollectionActivity + { + get + { + return ResourceManager.GetString("DataCollectionActivity", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You choose not to participate in Microsoft Azure PowerShell data collection.. + /// + public static string DataCollectionConfirmNo + { + get + { + return ResourceManager.GetString("DataCollectionConfirmNo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This confirmation message will be dismissed in '{0}' second(s).... + /// + public static string DataCollectionConfirmTime + { + get + { + return ResourceManager.GetString("DataCollectionConfirmTime", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You choose to participate in Microsoft Azure PowerShell data collection.. + /// + public static string DataCollectionConfirmYes + { + get + { + return ResourceManager.GetString("DataCollectionConfirmYes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The setting profile has been saved to the following path '{0}'.. + /// + public static string DataCollectionSaveFileInformation + { + get + { + return ResourceManager.GetString("DataCollectionSaveFileInformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Setting: {0} as the default and current subscription. To view other subscriptions use Get-AzureSubscription. + /// + public static string DefaultAndCurrentSubscription + { + get + { + return ResourceManager.GetString("DefaultAndCurrentSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to none. + /// + public static string DefaultFileVersion + { + get + { + return ResourceManager.GetString("DefaultFileVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There are no hostnames which could be used for validation.. + /// + public static string DefaultHostnamesValidation + { + get + { + return ResourceManager.GetString("DefaultHostnamesValidation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 8080. + /// + public static string DefaultPort + { + get + { + return ResourceManager.GetString("DefaultPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1000. + /// + public static string DefaultRoleCachingInMB + { + get + { + return ResourceManager.GetString("DefaultRoleCachingInMB", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Auto. + /// + public static string DefaultUpgradeMode + { + get + { + return ResourceManager.GetString("DefaultUpgradeMode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 80. + /// + public static string DefaultWebPort + { + get + { + return ResourceManager.GetString("DefaultWebPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Delete. + /// + public static string Delete + { + get + { + return ResourceManager.GetString("Delete", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The {0} slot for service {1} is already in {2} state. + /// + public static string DeploymentAlreadyInState + { + get + { + return ResourceManager.GetString("DeploymentAlreadyInState", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The deployment in {0} slot for service {1} is removed. + /// + public static string DeploymentRemovedMessage + { + get + { + return ResourceManager.GetString("DeploymentRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel. + /// + public static string DiagnosticLevelName + { + get + { + return ResourceManager.GetString("DiagnosticLevelName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1. + /// + public static string DiagnosticLevelValue + { + get + { + return ResourceManager.GetString("DiagnosticLevelValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The key to add already exists in the dictionary.. + /// + public static string DictionaryAddAlreadyContainsKey + { + get + { + return ResourceManager.GetString("DictionaryAddAlreadyContainsKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The array index cannot be less than zero.. + /// + public static string DictionaryCopyToArrayIndexLessThanZero + { + get + { + return ResourceManager.GetString("DictionaryCopyToArrayIndexLessThanZero", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The supplied array does not have enough room to contain the copied elements.. + /// + public static string DictionaryCopyToArrayTooShort + { + get + { + return ResourceManager.GetString("DictionaryCopyToArrayTooShort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided dns {0} doesn't exist. + /// + public static string DnsDoesNotExist + { + get + { + return ResourceManager.GetString("DnsDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft Azure Certificate. + /// + public static string EnableRemoteDesktop_FriendlyCertificateName + { + get + { + return ResourceManager.GetString("EnableRemoteDesktop_FriendlyCertificateName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Endpoint can't be retrieved for storage account. + /// + public static string EndPointNotFoundForBlobStorage + { + get + { + return ResourceManager.GetString("EndPointNotFoundForBlobStorage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} end processing.. + /// + public static string EndProcessingLog + { + get + { + return ResourceManager.GetString("EndProcessingLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To use Active Directory authentication, you must configure the ActiveDirectoryEndpoint, ActiveDirectoryTenantId, and ActiveDirectorServiceEndpointResourceId for environment of '{0}'. You can configure these properties for this environment using the Set-AzureEnvironment cmdlet.. + /// + public static string EnvironmentDoesNotSupportActiveDirectory + { + get + { + return ResourceManager.GetString("EnvironmentDoesNotSupportActiveDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The environment '{0}' already exists.. + /// + public static string EnvironmentExists + { + get + { + return ResourceManager.GetString("EnvironmentExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment name doesn't match one in subscription.. + /// + public static string EnvironmentNameDoesntMatchSubscription + { + get + { + return ResourceManager.GetString("EnvironmentNameDoesntMatchSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment name needs to be specified.. + /// + public static string EnvironmentNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("EnvironmentNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment needs to be specified.. + /// + public static string EnvironmentNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("EnvironmentNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The environment name '{0}' is not found.. + /// + public static string EnvironmentNotFound + { + get + { + return ResourceManager.GetString("EnvironmentNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to environments.xml. + /// + public static string EnvironmentsFileName + { + get + { + return ResourceManager.GetString("EnvironmentsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error creating VirtualMachine. + /// + public static string ErrorCreatingVirtualMachine + { + get + { + return ResourceManager.GetString("ErrorCreatingVirtualMachine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to download available runtimes for location '{0}'. + /// + public static string ErrorRetrievingRuntimesForLocation + { + get + { + return ResourceManager.GetString("ErrorRetrievingRuntimesForLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error updating VirtualMachine. + /// + public static string ErrorUpdatingVirtualMachine + { + get + { + return ResourceManager.GetString("ErrorUpdatingVirtualMachine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Job Id {0} failed. Error: {1}, ExceptionDetails: {2}. + /// + public static string FailedJobErrorMessage + { + get + { + return ResourceManager.GetString("FailedJobErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File path is not valid.. + /// + public static string FilePathIsNotValid + { + get + { + return ResourceManager.GetString("FilePathIsNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The HTTP request was forbidden with client authentication scheme 'Anonymous'.. + /// + public static string FirstPurchaseErrorMessage + { + get + { + return ResourceManager.GetString("FirstPurchaseErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This add-on requires you to purchase the first instance through the Microsoft Azure Portal. Subsequent purchases can be performed through PowerShell.. + /// + public static string FirstPurchaseMessage + { + get + { + return ResourceManager.GetString("FirstPurchaseMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Operation Status:. + /// + public static string GatewayOperationStatus + { + get + { + return ResourceManager.GetString("GatewayOperationStatus", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\General. + /// + public static string GeneralScaffolding + { + get + { + return ResourceManager.GetString("GeneralScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting all available Microsoft Azure Add-Ons, this may take few minutes.... + /// + public static string GetAllAddOnsWaitMessage + { + get + { + return ResourceManager.GetString("GetAllAddOnsWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Name{0}Primary Key{0}Seconday Key. + /// + public static string GetStorageKeysHeader + { + get + { + return ResourceManager.GetString("GetStorageKeysHeader", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Git not found. Please install git and place it in your command line path.. + /// + public static string GitNotFound + { + get + { + return ResourceManager.GetString("GitNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find publish settings. Please run Import-AzurePublishSettingsFile.. + /// + public static string GlobalSettingsManager_Load_PublishSettingsNotFound + { + get + { + return ResourceManager.GetString("GlobalSettingsManager_Load_PublishSettingsNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find the WadCfg end element in the config.. + /// + public static string IaasDiagnosticsBadConfigNoEndWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoEndWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WadCfg start element in the config is not matching the end element.. + /// + public static string IaasDiagnosticsBadConfigNoMatchingWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoMatchingWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find the WadCfg element in the config.. + /// + public static string IaasDiagnosticsBadConfigNoWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode.dll. + /// + public static string IISNodeDll + { + get + { + return ResourceManager.GetString("IISNodeDll", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode. + /// + public static string IISNodeEngineKey + { + get + { + return ResourceManager.GetString("IISNodeEngineKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode-dev\\release\\x64. + /// + public static string IISNodePath + { + get + { + return ResourceManager.GetString("IISNodePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode. + /// + public static string IISNodeRuntimeValue + { + get + { + return ResourceManager.GetString("IISNodeRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing IISNode version {0} in Azure for WebRole '{1}' (the version locally installed is: {2}). + /// + public static string IISNodeVersionWarningText + { + get + { + return ResourceManager.GetString("IISNodeVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Illegal characters in path.. + /// + public static string IllegalPath + { + get + { + return ResourceManager.GetString("IllegalPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. + /// + public static string InternalServerErrorMessage + { + get + { + return ResourceManager.GetString("InternalServerErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot enable memcach protocol on a cache worker role {0}.. + /// + public static string InvalidCacheRoleName + { + get + { + return ResourceManager.GetString("InvalidCacheRoleName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings. + /// + public static string InvalidCertificate + { + get + { + return ResourceManager.GetString("InvalidCertificate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid certificate format.. + /// + public static string InvalidCertificateSingle + { + get + { + return ResourceManager.GetString("InvalidCertificateSingle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided configuration path is invalid or doesn't exist. + /// + public static string InvalidConfigPath + { + get + { + return ResourceManager.GetString("InvalidConfigPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The country name is invalid, please use a valid two character country code, as described in ISO 3166-1 alpha-2.. + /// + public static string InvalidCountryNameMessage + { + get + { + return ResourceManager.GetString("InvalidCountryNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription.. + /// + public static string InvalidDefaultSubscription + { + get + { + return ResourceManager.GetString("InvalidDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deployment with {0} does not exist. + /// + public static string InvalidDeployment + { + get + { + return ResourceManager.GetString("InvalidDeployment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The deployment slot name {0} is invalid. Slot name must be either "Staging" or "Production".. + /// + public static string InvalidDeploymentSlot + { + get + { + return ResourceManager.GetString("InvalidDeploymentSlot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "{0}" is an invalid DNS name for {1}. + /// + public static string InvalidDnsName + { + get + { + return ResourceManager.GetString("InvalidDnsName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid service endpoint.. + /// + public static string InvalidEndpoint + { + get + { + return ResourceManager.GetString("InvalidEndpoint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided file in {0} must be have {1} extension. + /// + public static string InvalidFileExtension + { + get + { + return ResourceManager.GetString("InvalidFileExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File {0} has invalid characters. + /// + public static string InvalidFileName + { + get + { + return ResourceManager.GetString("InvalidFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must create your git publishing credentials using the Microsoft Azure portal. + ///Please follow these steps in the portal: + ///1. On the left side open "Web Sites" + ///2. Click on any website + ///3. Choose "Setup Git Publishing" or "Reset deployment credentials" + ///4. Back in the PowerShell window, rerun this command by typing "New-AzureWebSite {site name} -Git -PublishingUsername {username}. + /// + public static string InvalidGitCredentials + { + get + { + return ResourceManager.GetString("InvalidGitCredentials", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The value {0} provided is not a valid GUID. Please provide a valid GUID.. + /// + public static string InvalidGuid + { + get + { + return ResourceManager.GetString("InvalidGuid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The specified hostname does not exist. Please specify a valid hostname for the site.. + /// + public static string InvalidHostnameValidation + { + get + { + return ResourceManager.GetString("InvalidHostnameValidation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} instances must be greater than or equal 0 and less than or equal 20. + /// + public static string InvalidInstancesCount + { + get + { + return ResourceManager.GetString("InvalidInstancesCount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There was an error creating your webjob. Please make sure that the script is in the root folder of the zip file.. + /// + public static string InvalidJobFile + { + get + { + return ResourceManager.GetString("InvalidJobFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not download a valid runtime manifest, Please check your internet connection and try again.. + /// + public static string InvalidManifestError + { + get + { + return ResourceManager.GetString("InvalidManifestError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The account {0} was not found. Please specify a valid account name.. + /// + public static string InvalidMediaServicesAccount + { + get + { + return ResourceManager.GetString("InvalidMediaServicesAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided name "{0}" does not match the service bus namespace naming rules.. + /// + public static string InvalidNamespaceName + { + get + { + return ResourceManager.GetString("InvalidNamespaceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path must specify a valid path to an Azure profile.. + /// + public static string InvalidNewProfilePath + { + get + { + return ResourceManager.GetString("InvalidNewProfilePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Value cannot be null. Parameter name: '{0}'. + /// + public static string InvalidNullArgument + { + get + { + return ResourceManager.GetString("InvalidNullArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is invalid or empty. + /// + public static string InvalidOrEmptyArgumentMessage + { + get + { + return ResourceManager.GetString("InvalidOrEmptyArgumentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided package path is invalid or doesn't exist. + /// + public static string InvalidPackagePath + { + get + { + return ResourceManager.GetString("InvalidPackagePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}' is an invalid parameter set name.. + /// + public static string InvalidParameterSetName + { + get + { + return ResourceManager.GetString("InvalidParameterSetName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} doesn't exist in {1} or you've not passed valid value for it. + /// + public static string InvalidPath + { + get + { + return ResourceManager.GetString("InvalidPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path {0} has invalid characters. + /// + public static string InvalidPathName + { + get + { + return ResourceManager.GetString("InvalidPathName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain one of the following sets of properties: {SubscriptionId, Certificate}, {SubscriptionId, Username, Password}, {SubscriptionId, ServicePrincipal, Password, Tenant}, {SubscriptionId, AccountId, Token}. + /// + public static string InvalidProfileProperties + { + get + { + return ResourceManager.GetString("InvalidProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile. + /// + public static string InvalidPublishSettingsSchema + { + get + { + return ResourceManager.GetString("InvalidPublishSettingsSchema", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided role name "{0}" has invalid characters. + /// + public static string InvalidRoleNameMessage + { + get + { + return ResourceManager.GetString("InvalidRoleNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid name for the service root folder is required. + /// + public static string InvalidRootNameMessage + { + get + { + return ResourceManager.GetString("InvalidRootNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is not a recognized runtime type. + /// + public static string InvalidRuntimeError + { + get + { + return ResourceManager.GetString("InvalidRuntimeError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid language is required. + /// + public static string InvalidScaffoldingLanguageArg + { + get + { + return ResourceManager.GetString("InvalidScaffoldingLanguageArg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No subscription is currently selected. Use Select-Subscription to activate a subscription.. + /// + public static string InvalidSelectedSubscription + { + get + { + return ResourceManager.GetString("InvalidSelectedSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided location "{0}" does not exist in the available locations use Get-AzureSBLocation for listing available locations.. + /// + public static string InvalidServiceBusLocation + { + get + { + return ResourceManager.GetString("InvalidServiceBusLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please provide a service name or run this command from inside a service project directory.. + /// + public static string InvalidServiceName + { + get + { + return ResourceManager.GetString("InvalidServiceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must provide valid value for {0}. + /// + public static string InvalidServiceSettingElement + { + get + { + return ResourceManager.GetString("InvalidServiceSettingElement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to settings.json is invalid or doesn't exist. + /// + public static string InvalidServiceSettingMessage + { + get + { + return ResourceManager.GetString("InvalidServiceSettingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named '{0}' cannot be found. Use Set-AzureSubscription to initialize the subscription data.. + /// + public static string InvalidSubscription + { + get + { + return ResourceManager.GetString("InvalidSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided subscription id {0} is not valid. + /// + public static string InvalidSubscriptionId + { + get + { + return ResourceManager.GetString("InvalidSubscriptionId", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Must specify a non-null subscription name.. + /// + public static string InvalidSubscriptionName + { + get + { + return ResourceManager.GetString("InvalidSubscriptionName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid subscription name is required. This can be provided using the -Subscription parameter or by setting the subscription via the Set-AzureSubscription cmdlet. + /// + public static string InvalidSubscriptionNameMessage + { + get + { + return ResourceManager.GetString("InvalidSubscriptionNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided subscriptions file {0} has invalid content.. + /// + public static string InvalidSubscriptionsDataSchema + { + get + { + return ResourceManager.GetString("InvalidSubscriptionsDataSchema", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} VM size should be ExtraSmall, Small, Medium, Large or ExtraLarge.. + /// + public static string InvalidVMSize + { + get + { + return ResourceManager.GetString("InvalidVMSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The web job file must have *.zip extension. + /// + public static string InvalidWebJobFile + { + get + { + return ResourceManager.GetString("InvalidWebJobFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Singleton option works for continuous jobs only.. + /// + public static string InvalidWebJobSingleton + { + get + { + return ResourceManager.GetString("InvalidWebJobSingleton", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The website {0} was not found. Please specify a valid website name.. + /// + public static string InvalidWebsite + { + get + { + return ResourceManager.GetString("InvalidWebsite", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No job for id: {0} was found.. + /// + public static string JobNotFound + { + get + { + return ResourceManager.GetString("JobNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to engines. + /// + public static string JsonEnginesSectionName + { + get + { + return ResourceManager.GetString("JsonEnginesSectionName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Scaffolding for this language is not yet supported. + /// + public static string LanguageScaffoldingIsNotSupported + { + get + { + return ResourceManager.GetString("LanguageScaffoldingIsNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Link already established. + /// + public static string LinkAlreadyEstablished + { + get + { + return ResourceManager.GetString("LinkAlreadyEstablished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to local_package.csx. + /// + public static string LocalPackageFileName + { + get + { + return ResourceManager.GetString("LocalPackageFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceConfiguration.Local.cscfg. + /// + public static string LocalServiceConfigurationFileName + { + get + { + return ResourceManager.GetString("LocalServiceConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Looking for {0} deployment for {1} cloud service.... + /// + public static string LookingForDeploymentMessage + { + get + { + return ResourceManager.GetString("LookingForDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Looking for cloud service {0}.... + /// + public static string LookingForServiceMessage + { + get + { + return ResourceManager.GetString("LookingForServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure Long-Running Job. + /// + public static string LROJobName + { + get + { + return ResourceManager.GetString("LROJobName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet failed in background execution. The returned error was '{0}'. Please execute the cmdlet again. You may need to execute this cmdlet synchronously, by omitting the '-AsJob' parameter.. + /// + public static string LROTaskExceptionMessage + { + get + { + return ResourceManager.GetString("LROTaskExceptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to managementCertificate.pem. + /// + public static string ManagementCertificateFileName + { + get + { + return ResourceManager.GetString("ManagementCertificateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ?whr={0}. + /// + public static string ManagementPortalRealmFormat + { + get + { + return ResourceManager.GetString("ManagementPortalRealmFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to //baseuri. + /// + public static string ManifestBaseUriQuery + { + get + { + return ResourceManager.GetString("ManifestBaseUriQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to uri. + /// + public static string ManifestBlobUriKey + { + get + { + return ResourceManager.GetString("ManifestBlobUriKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to http://az413943.vo.msecnd.net/node/runtimemanifest_0.7.5.2.xml. + /// + public static string ManifestUri + { + get + { + return ResourceManager.GetString("ManifestUri", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'Certificate' of type 'X509Certificate2'.. + /// + public static string MissingCertificateInProfileProperties + { + get + { + return ResourceManager.GetString("MissingCertificateInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'Password' with an associated 'Username' or 'ServicePrincipal'.. + /// + public static string MissingPasswordInProfileProperties + { + get + { + return ResourceManager.GetString("MissingPasswordInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'SubscriptionId'.. + /// + public static string MissingSubscriptionInProfileProperties + { + get + { + return ResourceManager.GetString("MissingSubscriptionInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple Add-Ons found holding name {0}. + /// + public static string MultipleAddOnsFoundMessage + { + get + { + return ResourceManager.GetString("MultipleAddOnsFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple possible publishing users. Please go to the Portal and use the listed deployment user, or click 'set/reset deployment credentials' to set up a new user account, then reurn this cmdlet and specify PublishingUsername.. + /// + public static string MultiplePublishingUsernames + { + get + { + return ResourceManager.GetString("MultiplePublishingUsernames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The first publish settings file "{0}" is used. If you want to use another file specify the file name.. + /// + public static string MultiplePublishSettingsFilesFoundMessage + { + get + { + return ResourceManager.GetString("MultiplePublishSettingsFilesFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.NamedCaches. + /// + public static string NamedCacheSettingName + { + get + { + return ResourceManager.GetString("NamedCacheSettingName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":1},"serverNotification":{"isEnabled":false}},"secondaries":0}]}. + /// + public static string NamedCacheSettingValue + { + get + { + return ResourceManager.GetString("NamedCacheSettingValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A publishing username is required. Please specify one using the argument PublishingUsername.. + /// + public static string NeedPublishingUsernames + { + get + { + return ResourceManager.GetString("NeedPublishingUsernames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to New Add-On Confirmation. + /// + public static string NewAddOnConformation + { + get + { + return ResourceManager.GetString("NewAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my + ///contact information with {2}.. + /// + public static string NewMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("NewMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen because the namespace name is already used or due to an incorrect location name. Use Get-AzureSBLocation cmdlet to list valid names.. + /// + public static string NewNamespaceErrorMessage + { + get + { + return ResourceManager.GetString("NewNamespaceErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of + ///use and privacy statement at {0} and (c) agree to sharing my contact information with {2}.. + /// + public static string NewNonMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("NewNonMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service has been created at {0}. + /// + public static string NewServiceCreatedMessage + { + get + { + return ResourceManager.GetString("NewServiceCreatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No. + /// + public static string No + { + get + { + return ResourceManager.GetString("No", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no access token cached for subscription {0}, user id {1}. Use the Add-AzureAccount cmdlet to log in again and get a token for this subscription.. + /// + public static string NoCachedToken + { + get + { + return ResourceManager.GetString("NoCachedToken", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The service does not have any cache worker roles, add one first by running cmdlet Add-AzureCacheWorkerRole.. + /// + public static string NoCacheWorkerRoles + { + get + { + return ResourceManager.GetString("NoCacheWorkerRoles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No clouds available. + /// + public static string NoCloudsAvailable + { + get + { + return ResourceManager.GetString("NoCloudsAvailable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "There is no current context, please log in using Connect-AzAccount.". + /// + public static string NoCurrentContextForDataCmdlet + { + get + { + return ResourceManager.GetString("NoCurrentContextForDataCmdlet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to nodejs. + /// + public static string NodeDirectory + { + get + { + return ResourceManager.GetString("NodeDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node. + /// + public static string NodeEngineKey + { + get + { + return ResourceManager.GetString("NodeEngineKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node.exe. + /// + public static string NodeExe + { + get + { + return ResourceManager.GetString("NodeExe", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no default subscription set, please set a default subscription by running Set-AzureSubscription -Default <subscription name>. + /// + public static string NoDefaultSubscriptionMessage + { + get + { + return ResourceManager.GetString("NoDefaultSubscriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft SDKs\Azure\Nodejs\Nov2011. + /// + public static string NodeModulesPath + { + get + { + return ResourceManager.GetString("NodeModulesPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to nodejs. + /// + public static string NodeProgramFilesFolderName + { + get + { + return ResourceManager.GetString("NodeProgramFilesFolderName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node. + /// + public static string NodeRuntimeValue + { + get + { + return ResourceManager.GetString("NodeRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\Node. + /// + public static string NodeScaffolding + { + get + { + return ResourceManager.GetString("NodeScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.Node. + /// + public static string NodeScaffoldingResources + { + get + { + return ResourceManager.GetString("NodeScaffoldingResources", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing Node version {0} in Azure for Role '{1}' (the Node version locally installed is: {2}). + /// + public static string NodeVersionWarningText + { + get + { + return ResourceManager.GetString("NodeVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No, I do not agree. + /// + public static string NoHint + { + get + { + return ResourceManager.GetString("NoHint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please connect to internet before executing this cmdlet. + /// + public static string NoInternetConnection + { + get + { + return ResourceManager.GetString("NoInternetConnection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <NONE>. + /// + public static string None + { + get + { + return ResourceManager.GetString("None", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No publish settings files with extension *.publishsettings are found in the directory "{0}".. + /// + public static string NoPublishSettingsFilesFoundMessage + { + get + { + return ResourceManager.GetString("NoPublishSettingsFilesFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no subscription associated with account {0}.. + /// + public static string NoSubscriptionAddedMessage + { + get + { + return ResourceManager.GetString("NoSubscriptionAddedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No subscriptions are associated with the logged in account in Azure Service Management (RDFE). This means that the logged in user is not an administrator or co-administrator for any account.\r\nDid you mean to execute Connect-AzAccount?. + /// + public static string NoSubscriptionFoundForTenant + { + get + { + return ResourceManager.GetString("NoSubscriptionFoundForTenant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}' must be a cache worker role. Verify that it has proper cache worker role configuration.. + /// + public static string NotCacheWorkerRole + { + get + { + return ResourceManager.GetString("NotCacheWorkerRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Certificate can't be null.. + /// + public static string NullCertificateMessage + { + get + { + return ResourceManager.GetString("NullCertificateMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} could not be null or empty. + /// + public static string NullObjectMessage + { + get + { + return ResourceManager.GetString("NullObjectMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to add a null RoleSettings to {0}. + /// + public static string NullRoleSettingsMessage + { + get + { + return ResourceManager.GetString("NullRoleSettingsMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to add new role to null service definition. + /// + public static string NullServiceDefinitionMessage + { + get + { + return ResourceManager.GetString("NullServiceDefinitionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The request offer '{0}' is not found.. + /// + public static string OfferNotFoundMessage + { + get + { + return ResourceManager.GetString("OfferNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Operation "{0}" failed on VM with ID: {1}. + /// + public static string OperationFailedErrorMessage + { + get + { + return ResourceManager.GetString("OperationFailedErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The REST operation failed with message '{0}' and error code '{1}'. + /// + public static string OperationFailedMessage + { + get + { + return ResourceManager.GetString("OperationFailedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Job Id {0} did not complete within expected time or it is in Failed/Canceled/Invalid state.. + /// + public static string OperationTimedOutOrError + { + get + { + return ResourceManager.GetString("OperationTimedOutOrError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to package. + /// + public static string Package + { + get + { + return ResourceManager.GetString("Package", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Package is created at service root path {0}.. + /// + public static string PackageCreated + { + get + { + return ResourceManager.GetString("PackageCreated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {{ + /// "author": "", + /// + /// "name": "{0}", + /// "version": "0.0.0", + /// "dependencies":{{}}, + /// "devDependencies":{{}}, + /// "optionalDependencies": {{}}, + /// "engines": {{ + /// "node": "*", + /// "iisnode": "*" + /// }} + /// + ///}} + ///. + /// + public static string PackageJsonDefaultFile + { + get + { + return ResourceManager.GetString("PackageJsonDefaultFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to package.json. + /// + public static string PackageJsonFileName + { + get + { + return ResourceManager.GetString("PackageJsonFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path {0} doesn't exist.. + /// + public static string PathDoesNotExist + { + get + { + return ResourceManager.GetString("PathDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path for {0} doesn't exist in {1}.. + /// + public static string PathDoesNotExistForElement + { + get + { + return ResourceManager.GetString("PathDoesNotExistForElement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the Peer Asn has to be provided.. + /// + public static string PeerAsnRequired + { + get + { + return ResourceManager.GetString("PeerAsnRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 5.4.0. + /// + public static string PHPDefaultRuntimeVersion + { + get + { + return ResourceManager.GetString("PHPDefaultRuntimeVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to php. + /// + public static string PhpRuntimeValue + { + get + { + return ResourceManager.GetString("PhpRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\PHP. + /// + public static string PHPScaffolding + { + get + { + return ResourceManager.GetString("PHPScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.PHP. + /// + public static string PHPScaffoldingResources + { + get + { + return ResourceManager.GetString("PHPScaffoldingResources", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing PHP version {0} for Role '{1}' (the PHP version locally installed is: {2}). + /// + public static string PHPVersionWarningText + { + get + { + return ResourceManager.GetString("PHPVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must create your first web site using the Microsoft Azure portal. + ///Please follow these steps in the portal: + ///1. At the bottom of the page, click on New > Web Site > Quick Create + ///2. Type {0} in the URL field + ///3. Click on "Create Web Site" + ///4. Once the site has been created, click on the site name + ///5. Click on "Set up Git publishing" or "Reset deployment credentials" and setup a publishing username and password. Use those credentials for all new websites you create.. + /// + public static string PortalInstructions + { + get + { + return ResourceManager.GetString("PortalInstructions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 6. Back in the console window, rerun this command by typing "New-AzureWebsite <site name> -Git". + /// + public static string PortalInstructionsGit + { + get + { + return ResourceManager.GetString("PortalInstructionsGit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The estimated generally available date is '{0}'.. + /// + public static string PreviewCmdletETAMessage { + get { + return ResourceManager.GetString("PreviewCmdletETAMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet is in preview. Its behavior is subject to change based on customer feedback.. + /// + public static string PreviewCmdletMessage + { + get + { + return ResourceManager.GetString("PreviewCmdletMessage", resourceCulture); + } + } + + + /// + /// Looks up a localized string similar to A value for the Primary Peer Subnet has to be provided.. + /// + public static string PrimaryPeerSubnetRequired + { + get + { + return ResourceManager.GetString("PrimaryPeerSubnetRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Promotion code can be used only when updating to a new plan.. + /// + public static string PromotionCodeWithCurrentPlanMessage + { + get + { + return ResourceManager.GetString("PromotionCodeWithCurrentPlanMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service not published at user request.. + /// + public static string PublishAbortedAtUserRequest + { + get + { + return ResourceManager.GetString("PublishAbortedAtUserRequest", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Complete.. + /// + public static string PublishCompleteMessage + { + get + { + return ResourceManager.GetString("PublishCompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Connecting.... + /// + public static string PublishConnectingMessage + { + get + { + return ResourceManager.GetString("PublishConnectingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created Deployment ID: {0}.. + /// + public static string PublishCreatedDeploymentMessage + { + get + { + return ResourceManager.GetString("PublishCreatedDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created hosted service '{0}'.. + /// + public static string PublishCreatedServiceMessage + { + get + { + return ResourceManager.GetString("PublishCreatedServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created Website URL: {0}.. + /// + public static string PublishCreatedWebsiteMessage + { + get + { + return ResourceManager.GetString("PublishCreatedWebsiteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating.... + /// + public static string PublishCreatingServiceMessage + { + get + { + return ResourceManager.GetString("PublishCreatingServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Initializing.... + /// + public static string PublishInitializingMessage + { + get + { + return ResourceManager.GetString("PublishInitializingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to busy. + /// + public static string PublishInstanceStatusBusy + { + get + { + return ResourceManager.GetString("PublishInstanceStatusBusy", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to creating the virtual machine. + /// + public static string PublishInstanceStatusCreating + { + get + { + return ResourceManager.GetString("PublishInstanceStatusCreating", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Instance {0} of role {1} is {2}.. + /// + public static string PublishInstanceStatusMessage + { + get + { + return ResourceManager.GetString("PublishInstanceStatusMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ready. + /// + public static string PublishInstanceStatusReady + { + get + { + return ResourceManager.GetString("PublishInstanceStatusReady", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Preparing deployment for {0} with Subscription ID: {1}.... + /// + public static string PublishPreparingDeploymentMessage + { + get + { + return ResourceManager.GetString("PublishPreparingDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Publishing {0} to Microsoft Azure. This may take several minutes.... + /// + public static string PublishServiceStartMessage + { + get + { + return ResourceManager.GetString("PublishServiceStartMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to publish settings. + /// + public static string PublishSettings + { + get + { + return ResourceManager.GetString("PublishSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure. + /// + public static string PublishSettingsElementName + { + get + { + return ResourceManager.GetString("PublishSettingsElementName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to .PublishSettings. + /// + public static string PublishSettingsFileExtention + { + get + { + return ResourceManager.GetString("PublishSettingsFileExtention", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to publishSettings.xml. + /// + public static string PublishSettingsFileName + { + get + { + return ResourceManager.GetString("PublishSettingsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to &whr={0}. + /// + public static string PublishSettingsFileRealmFormat + { + get + { + return ResourceManager.GetString("PublishSettingsFileRealmFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Publish settings imported. + /// + public static string PublishSettingsSetSuccessfully + { + get + { + return ResourceManager.GetString("PublishSettingsSetSuccessfully", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_PUBLISHINGPROFILE_URL. + /// + public static string PublishSettingsUrlEnv + { + get + { + return ResourceManager.GetString("PublishSettingsUrlEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting.... + /// + public static string PublishStartingMessage + { + get + { + return ResourceManager.GetString("PublishStartingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Upgrading.... + /// + public static string PublishUpgradingMessage + { + get + { + return ResourceManager.GetString("PublishUpgradingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Uploading Package to storage service {0}.... + /// + public static string PublishUploadingPackageMessage + { + get + { + return ResourceManager.GetString("PublishUploadingPackageMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Verifying storage account '{0}'.... + /// + public static string PublishVerifyingStorageMessage + { + get + { + return ResourceManager.GetString("PublishVerifyingStorageMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path '{0}' not found.. + /// + public static string PublishVMDscExtensionAdditionalContentPathNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionAdditionalContentPathNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration published to {0}. + /// + public static string PublishVMDscExtensionArchiveUploadedMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionArchiveUploadedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Copy '{0}' to '{1}'.. + /// + public static string PublishVMDscExtensionCopyFileVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCopyFileVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Copy the module '{0}' to '{1}'.. + /// + public static string PublishVMDscExtensionCopyModuleVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCopyModuleVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid configuration file: {0}. + ///The file needs to be a PowerShell script (.ps1 or .psm1).. + /// + public static string PublishVMDscExtensionCreateArchiveConfigFileInvalidExtension + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCreateArchiveConfigFileInvalidExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleted '{0}'. + /// + public static string PublishVMDscExtensionDeletedFileMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDeletedFileMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot delete '{0}': {1}. + /// + public static string PublishVMDscExtensionDeleteErrorMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDeleteErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path '{0}' not found.. + /// + public static string PublishVMDscExtensionDirectoryNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDirectoryNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot get module for DscResource '{0}'. Possible solutions: + ///1) Specify -ModuleName for Import-DscResource in your configuration. + ///2) Unblock module that contains resource. + ///3) Move Import-DscResource inside Node block. + ///. + /// + public static string PublishVMDscExtensionGetDscResourceFailed + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionGetDscResourceFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to List of required modules: [{0}].. + /// + public static string PublishVMDscExtensionRequiredModulesVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionRequiredModulesVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your current PowerShell version {1} is less then required by this cmdlet {0}. Consider download and install latest PowerShell version.. + /// + public static string PublishVMDscExtensionRequiredPsVersion + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionRequiredPsVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration script '{0}' contained parse errors: + ///{1}. + /// + public static string PublishVMDscExtensionStorageParserErrors + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionStorageParserErrors", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Temp folder '{0}' created.. + /// + public static string PublishVMDscExtensionTempFolderVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionTempFolderVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid configuration file: {0}. + ///The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip).. + /// + public static string PublishVMDscExtensionUploadArchiveConfigFileInvalidExtension + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionUploadArchiveConfigFileInvalidExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration file '{0}' not found.. + /// + public static string PublishVMDscExtensionUploadArchiveConfigFileNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionUploadArchiveConfigFileNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure PowerShell collects usage data in order to improve your experience. + ///The data is anonymous and does not include commandline argument values. + ///The data is collected by Microsoft. + /// + ///Use the Disable-AzureDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Azure module. To disable data collection: PS > Disable-AzureDataCollection. + ///Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Azure module. To enable data collection: PS > Enab [rest of string was truncated]";. + /// + public static string RDFEDataCollectionMessage + { + get + { + return ResourceManager.GetString("RDFEDataCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Replace current deployment with '{0}' Id ?. + /// + public static string RedeployCommit + { + get + { + return ResourceManager.GetString("RedeployCommit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to regenerate key?. + /// + public static string RegenerateKeyWarning + { + get + { + return ResourceManager.GetString("RegenerateKeyWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Generate new key.. + /// + public static string RegenerateKeyWhatIfMessage + { + get + { + return ResourceManager.GetString("RegenerateKeyWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove account '{0}'?. + /// + public static string RemoveAccountConfirmation + { + get + { + return ResourceManager.GetString("RemoveAccountConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing account. + /// + public static string RemoveAccountMessage + { + get + { + return ResourceManager.GetString("RemoveAccountMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove Add-On Confirmation. + /// + public static string RemoveAddOnConformation + { + get + { + return ResourceManager.GetString("RemoveAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to If you delete this add-on, your data may be deleted and the operation may not be undone. You may have to purchase it again from the Microsoft Azure Store to use it. The price of the add-on may not be refunded. Are you sure you want to delete this add-on? Enter “Yes” to confirm.. + /// + public static string RemoveAddOnMessage + { + get + { + return ResourceManager.GetString("RemoveAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureBGPPeering Operation failed.. + /// + public static string RemoveAzureBGPPeeringFailed + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Bgp Peering. + /// + public static string RemoveAzureBGPPeeringMessage + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Bgp Peering with Service Key {0}.. + /// + public static string RemoveAzureBGPPeeringSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Bgp Peering with service key '{0}'?. + /// + public static string RemoveAzureBGPPeeringWarning + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Dedicated Circuit with service key '{0}'?. + /// + public static string RemoveAzureDedicatdCircuitWarning + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatdCircuitWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureDedicatedCircuit Operation failed.. + /// + public static string RemoveAzureDedicatedCircuitFailed + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureDedicatedCircuitLink Operation failed.. + /// + public static string RemoveAzureDedicatedCircuitLinkFailed + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Dedicated Circui Link. + /// + public static string RemoveAzureDedicatedCircuitLinkMessage + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Dedicated Circuit Link with Service Key {0} and Vnet Name {1}. + /// + public static string RemoveAzureDedicatedCircuitLinkSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Dedicated Circuit Link with service key '{0}' and virtual network name '{1}'?. + /// + public static string RemoveAzureDedicatedCircuitLinkWarning + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Dedicated Circuit. + /// + public static string RemoveAzureDedicatedCircuitMessage + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Dedicated Circuit with Service Key {0}.. + /// + public static string RemoveAzureDedicatedCircuitSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing cloud service {0}.... + /// + public static string RemoveAzureServiceWaitMessage + { + get + { + return ResourceManager.GetString("RemoveAzureServiceWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The default subscription is being removed. Use Select-AzureSubscription -Default <subscriptionName> to select a new default subscription.. + /// + public static string RemoveDefaultSubscription + { + get + { + return ResourceManager.GetString("RemoveDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing {0} deployment for {1} service. + /// + public static string RemoveDeploymentWaitMessage + { + get + { + return ResourceManager.GetString("RemoveDeploymentWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing an environment will remove all associated subscriptions and accounts. Are you sure you want to remove an environment '{0}'?. + /// + public static string RemoveEnvironmentConfirmation + { + get + { + return ResourceManager.GetString("RemoveEnvironmentConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing environment. + /// + public static string RemoveEnvironmentMessage + { + get + { + return ResourceManager.GetString("RemoveEnvironmentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing job collection. + /// + public static string RemoveJobCollectionMessage + { + get + { + return ResourceManager.GetString("RemoveJobCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the job collection "{0}". + /// + public static string RemoveJobCollectionWarning + { + get + { + return ResourceManager.GetString("RemoveJobCollectionWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing job. + /// + public static string RemoveJobMessage + { + get + { + return ResourceManager.GetString("RemoveJobMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the job "{0}". + /// + public static string RemoveJobWarning + { + get + { + return ResourceManager.GetString("RemoveJobWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the account?. + /// + public static string RemoveMediaAccountWarning + { + get + { + return ResourceManager.GetString("RemoveMediaAccountWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account removed.. + /// + public static string RemoveMediaAccountWhatIfMessage + { + get + { + return ResourceManager.GetString("RemoveMediaAccountWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen because the namespace does not exist or it does not exist under your subscription.. + /// + public static string RemoveNamespaceErrorMessage + { + get + { + return ResourceManager.GetString("RemoveNamespaceErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing old package {0}.... + /// + public static string RemovePackage + { + get + { + return ResourceManager.GetString("RemovePackage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the Azure profile will remove all associated environments, subscriptions, and accounts. Are you sure you want to remove the Azure profile?. + /// + public static string RemoveProfileConfirmation + { + get + { + return ResourceManager.GetString("RemoveProfileConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the Azure profile. + /// + public static string RemoveProfileMessage + { + get + { + return ResourceManager.GetString("RemoveProfileMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete the namespace '{0}'?. + /// + public static string RemoveServiceBusNamespaceConfirmation + { + get + { + return ResourceManager.GetString("RemoveServiceBusNamespaceConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove cloud service?. + /// + public static string RemoveServiceWarning + { + get + { + return ResourceManager.GetString("RemoveServiceWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove cloud service and all it's deployments. + /// + public static string RemoveServiceWhatIfMessage + { + get + { + return ResourceManager.GetString("RemoveServiceWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove subscription '{0}'?. + /// + public static string RemoveSubscriptionConfirmation + { + get + { + return ResourceManager.GetString("RemoveSubscriptionConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing subscription. + /// + public static string RemoveSubscriptionMessage + { + get + { + return ResourceManager.GetString("RemoveSubscriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The endpoint {0} cannot be removed from profile {1} because it's not in the profile.. + /// + public static string RemoveTrafficManagerEndpointMissing + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerEndpointMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureTrafficManagerProfile Operation failed.. + /// + public static string RemoveTrafficManagerProfileFailed + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Traffic Manager profile with name {0}.. + /// + public static string RemoveTrafficManagerProfileSucceeded + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Traffic Manager profile "{0}"?. + /// + public static string RemoveTrafficManagerProfileWarning + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete the VM '{0}'?. + /// + public static string RemoveVMConfirmationMessage + { + get + { + return ResourceManager.GetString("RemoveVMConfirmationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleting VM.. + /// + public static string RemoveVMMessage + { + get + { + return ResourceManager.GetString("RemoveVMMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing WebJob.... + /// + public static string RemoveWebJobMessage + { + get + { + return ResourceManager.GetString("RemoveWebJobMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove job '{0}'?. + /// + public static string RemoveWebJobWarning + { + get + { + return ResourceManager.GetString("RemoveWebJobWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing website. + /// + public static string RemoveWebsiteMessage + { + get + { + return ResourceManager.GetString("RemoveWebsiteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the website "{0}". + /// + public static string RemoveWebsiteWarning + { + get + { + return ResourceManager.GetString("RemoveWebsiteWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing public environment is not supported.. + /// + public static string RemovingDefaultEnvironmentsNotSupported + { + get + { + return ResourceManager.GetString("RemovingDefaultEnvironmentsNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleting namespace. + /// + public static string RemovingNamespaceMessage + { + get + { + return ResourceManager.GetString("RemovingNamespaceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Repository is not setup. You need to pass a valid site name.. + /// + public static string RepositoryNotSetup + { + get + { + return ResourceManager.GetString("RepositoryNotSetup", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Reserved IP with the Name:'{0}' will no longer be in use after the deployment is deleted, and it is still reserved for later use.. + /// + public static string ReservedIPNameNoLongerInUseButStillBeingReserved + { + get + { + return ResourceManager.GetString("ReservedIPNameNoLongerInUseButStillBeingReserved", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resource with ID : {0} does not exist.. + /// + public static string ResourceNotFound + { + get + { + return ResourceManager.GetString("ResourceNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Restart. + /// + public static string Restart + { + get + { + return ResourceManager.GetString("Restart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resume. + /// + public static string Resume + { + get + { + return ResourceManager.GetString("Resume", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /role:{0};"{1}/{0}" . + /// + public static string RoleArgTemplate + { + get + { + return ResourceManager.GetString("RoleArgTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to bin. + /// + public static string RoleBinFolderName + { + get + { + return ResourceManager.GetString("RoleBinFolderName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} is {1}. + /// + public static string RoleInstanceWaitMsg + { + get + { + return ResourceManager.GetString("RoleInstanceWaitMsg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 20. + /// + public static string RoleMaxInstances + { + get + { + return ResourceManager.GetString("RoleMaxInstances", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to role name. + /// + public static string RoleName + { + get + { + return ResourceManager.GetString("RoleName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided role name {0} doesn't exist. + /// + public static string RoleNotFoundMessage + { + get + { + return ResourceManager.GetString("RoleNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RoleSettings.xml. + /// + public static string RoleSettingsTemplateFileName + { + get + { + return ResourceManager.GetString("RoleSettingsTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role type {0} doesn't exist. + /// + public static string RoleTypeDoesNotExist + { + get + { + return ResourceManager.GetString("RoleTypeDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to public static Dictionary<string, Location> ReverseLocations { get; private set; }. + /// + public static string RuntimeDeploymentLocationError + { + get + { + return ResourceManager.GetString("RuntimeDeploymentLocationError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Preparing runtime deployment for service '{0}'. + /// + public static string RuntimeDeploymentStart + { + get + { + return ResourceManager.GetString("RuntimeDeploymentStart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WARNING Runtime Mismatch: Are you sure that you want to publish service '{0}' using an Azure runtime version that does not match your local runtime version?. + /// + public static string RuntimeMismatchWarning + { + get + { + return ResourceManager.GetString("RuntimeMismatchWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEOVERRIDEURL. + /// + public static string RuntimeOverrideKey + { + get + { + return ResourceManager.GetString("RuntimeOverrideKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /runtimemanifest/runtimes/runtime. + /// + public static string RuntimeQuery + { + get + { + return ResourceManager.GetString("RuntimeQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEID. + /// + public static string RuntimeTypeKey + { + get + { + return ResourceManager.GetString("RuntimeTypeKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEURL. + /// + public static string RuntimeUrlKey + { + get + { + return ResourceManager.GetString("RuntimeUrlKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEVERSIONPRIMARYKEY. + /// + public static string RuntimeVersionPrimaryKey + { + get + { + return ResourceManager.GetString("RuntimeVersionPrimaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to scaffold.xml. + /// + public static string ScaffoldXml + { + get + { + return ResourceManager.GetString("ScaffoldXml", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid location entered. Pick one of the locations from Get-AzureSchedulerLocation. + /// + public static string SchedulerInvalidLocation + { + get + { + return ResourceManager.GetString("SchedulerInvalidLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the Secondary Peer Subnet has to be provided.. + /// + public static string SecondaryPeerSubnetRequired + { + get + { + return ResourceManager.GetString("SecondaryPeerSubnetRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} already exists on disk in location {1}. + /// + public static string ServiceAlreadyExistsOnDisk + { + get + { + return ResourceManager.GetString("ServiceAlreadyExistsOnDisk", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No ServiceBus authorization rule with the given characteristics was found. + /// + public static string ServiceBusAuthorizationRuleNotFound + { + get + { + return ResourceManager.GetString("ServiceBusAuthorizationRuleNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The service bus entity '{0}' is not found.. + /// + public static string ServiceBusEntityTypeNotFound + { + get + { + return ResourceManager.GetString("ServiceBusEntityTypeNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen due to an incorrect/missing namespace. + /// + public static string ServiceBusNamespaceMissingMessage + { + get + { + return ResourceManager.GetString("ServiceBusNamespaceMissingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service configuration. + /// + public static string ServiceConfiguration + { + get + { + return ResourceManager.GetString("ServiceConfiguration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service definition. + /// + public static string ServiceDefinition + { + get + { + return ResourceManager.GetString("ServiceDefinition", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceDefinition.csdef. + /// + public static string ServiceDefinitionFileName + { + get + { + return ResourceManager.GetString("ServiceDefinitionFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}Deploy. + /// + public static string ServiceDeploymentName + { + get + { + return ResourceManager.GetString("ServiceDeploymentName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The specified cloud service "{0}" does not exist.. + /// + public static string ServiceDoesNotExist + { + get + { + return ResourceManager.GetString("ServiceDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} slot for service {1} is in {2} state, please wait until it finish and update it's status. + /// + public static string ServiceIsInTransitionState + { + get + { + return ResourceManager.GetString("ServiceIsInTransitionState", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}.". + /// + public static string ServiceManagementClientExceptionStringFormat + { + get + { + return ResourceManager.GetString("ServiceManagementClientExceptionStringFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Begin Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionBeginOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionBeginOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Completed Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionCompletedOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionCompletedOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Begin Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionInOCSBeginOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionInOCSBeginOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Completed Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionInOCSCompletedOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionInOCSCompletedOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service name. + /// + public static string ServiceName + { + get + { + return ResourceManager.GetString("ServiceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided service name {0} already exists, please pick another name. + /// + public static string ServiceNameExists + { + get + { + return ResourceManager.GetString("ServiceNameExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please provide name for the hosted service. + /// + public static string ServiceNameMissingMessage + { + get + { + return ResourceManager.GetString("ServiceNameMissingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service parent directory. + /// + public static string ServiceParentDirectory + { + get + { + return ResourceManager.GetString("ServiceParentDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} removed successfully. + /// + public static string ServiceRemovedMessage + { + get + { + return ResourceManager.GetString("ServiceRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service directory. + /// + public static string ServiceRoot + { + get + { + return ResourceManager.GetString("ServiceRoot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service settings. + /// + public static string ServiceSettings + { + get + { + return ResourceManager.GetString("ServiceSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.. + /// + public static string ServiceSettings_ValidateStorageAccountName_InvalidName + { + get + { + return ResourceManager.GetString("ServiceSettings_ValidateStorageAccountName_InvalidName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The {0} slot for cloud service {1} doesn't exist.. + /// + public static string ServiceSlotDoesNotExist + { + get + { + return ResourceManager.GetString("ServiceSlotDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} slot for service {1} is {2}. + /// + public static string ServiceStatusChanged + { + get + { + return ResourceManager.GetString("ServiceStatusChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Set Add-On Confirmation. + /// + public static string SetAddOnConformation + { + get + { + return ResourceManager.GetString("SetAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Profile {0} does not contain endpoint {1}. Adding it.. + /// + public static string SetInexistentTrafficManagerEndpointMessage + { + get + { + return ResourceManager.GetString("SetInexistentTrafficManagerEndpointMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note - You will be charged the amount for the new plan, without being refunded for time remaining + ///in the existing plan. + ///By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my + ///contact information with {2}.. + /// + public static string SetMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("SetMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note - You will be charged the amount for the new plan, without being refunded for time remaining + ///in the existing plan. + ///By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of + ///use and privacy statement at <url> and (c) agree to sharing my contact information with {2}.. + /// + public static string SetNonMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("SetNonMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} instances are set to {1}. + /// + public static string SetRoleInstancesMessage + { + get + { + return ResourceManager.GetString("SetRoleInstancesMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"Slot":"","Location":"","Subscription":"","StorageAccountName":""}. + /// + public static string SettingsFileEmptyContent + { + get + { + return ResourceManager.GetString("SettingsFileEmptyContent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to deploymentSettings.json. + /// + public static string SettingsFileName + { + get + { + return ResourceManager.GetString("SettingsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Insufficient parameters passed to create a new endpoint.. + /// + public static string SetTrafficManagerEndpointNeedsParameters + { + get + { + return ResourceManager.GetString("SetTrafficManagerEndpointNeedsParameters", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Ambiguous operation: the profile name specified doesn't match the name of the profile object.. + /// + public static string SetTrafficManagerProfileAmbiguous + { + get + { + return ResourceManager.GetString("SetTrafficManagerProfileAmbiguous", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and include the 'Force' parameter, if available, to avoid unnecessary prompts.. + /// + public static string ShouldContinueFail + { + get + { + return ResourceManager.GetString("ShouldContinueFail", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Confirm. + /// + public static string ShouldProcessCaption + { + get + { + return ResourceManager.GetString("ShouldProcessCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and omit the 'Confirm' parameter when using the 'AsJob' parameter.. + /// + public static string ShouldProcessFailConfirm + { + get + { + return ResourceManager.GetString("ShouldProcessFailConfirm", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please increase the user $ConfirmPreference setting, or include turn off confirmation using '-Confirm:$false' when using the 'AsJob' parameter and execute the cmdet again.. + /// + public static string ShouldProcessFailImpact + { + get + { + return ResourceManager.GetString("ShouldProcessFailImpact", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and omit the 'WhatIf' parameter when using the 'AsJob' parameter.. + /// + public static string ShouldProcessFailWhatIf + { + get + { + return ResourceManager.GetString("ShouldProcessFailWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Shutdown. + /// + public static string Shutdown + { + get + { + return ResourceManager.GetString("Shutdown", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /sites:{0};{1};"{2}/{0}" . + /// + public static string SitesArgTemplate + { + get + { + return ResourceManager.GetString("SitesArgTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1000. + /// + public static string StandardRetryDelayInMs + { + get + { + return ResourceManager.GetString("StandardRetryDelayInMs", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Start. + /// + public static string Start + { + get + { + return ResourceManager.GetString("Start", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Started. + /// + public static string StartedEmulator + { + get + { + return ResourceManager.GetString("StartedEmulator", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting Emulator.... + /// + public static string StartingEmulator + { + get + { + return ResourceManager.GetString("StartingEmulator", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to start. + /// + public static string StartStorageEmulatorCommandArgument + { + get + { + return ResourceManager.GetString("StartStorageEmulatorCommandArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stop. + /// + public static string Stop + { + get + { + return ResourceManager.GetString("Stop", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stopping emulator.... + /// + public static string StopEmulatorMessage + { + get + { + return ResourceManager.GetString("StopEmulatorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stopped. + /// + public static string StoppedEmulatorMessage + { + get + { + return ResourceManager.GetString("StoppedEmulatorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to stop. + /// + public static string StopStorageEmulatorCommandArgument + { + get + { + return ResourceManager.GetString("StopStorageEmulatorCommandArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account Name:. + /// + public static string StorageAccountName + { + get + { + return ResourceManager.GetString("StorageAccountName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find storage account '{0}' please type the name of an existing storage account.. + /// + public static string StorageAccountNotFound + { + get + { + return ResourceManager.GetString("StorageAccountNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AzureStorageEmulator.exe. + /// + public static string StorageEmulatorExe + { + get + { + return ResourceManager.GetString("StorageEmulatorExe", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to InstallPath. + /// + public static string StorageEmulatorInstallPathRegistryKeyValue + { + get + { + return ResourceManager.GetString("StorageEmulatorInstallPathRegistryKeyValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SOFTWARE\Microsoft\Windows Azure Storage Emulator. + /// + public static string StorageEmulatorRegistryKey + { + get + { + return ResourceManager.GetString("StorageEmulatorRegistryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Primary Key:. + /// + public static string StoragePrimaryKey + { + get + { + return ResourceManager.GetString("StoragePrimaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Secondary Key:. + /// + public static string StorageSecondaryKey + { + get + { + return ResourceManager.GetString("StorageSecondaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named {0} already exists.. + /// + public static string SubscriptionAlreadyExists + { + get + { + return ResourceManager.GetString("SubscriptionAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The SubscriptionDataFile parameter is deprecated. This parameter will be removed in a future release. See https://github.com/Azure/azure-powershell/wiki/Proposed-Design-Stateless-Azure-Profile for a description of the upcoming mechanism for providing alternate sources of subscription information.. + /// + public static string SubscriptionDataFileDeprecated + { + get + { + return ResourceManager.GetString("SubscriptionDataFileDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DefaultSubscriptionData.xml. + /// + public static string SubscriptionDataFileName + { + get + { + return ResourceManager.GetString("SubscriptionDataFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription data file {0} does not exist.. + /// + public static string SubscriptionDataFileNotFound + { + get + { + return ResourceManager.GetString("SubscriptionDataFileNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription id {0} doesn't exist.. + /// + public static string SubscriptionIdNotFoundMessage + { + get + { + return ResourceManager.GetString("SubscriptionIdNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription must not be null. + /// + public static string SubscriptionMustNotBeNull + { + get + { + return ResourceManager.GetString("SubscriptionMustNotBeNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription name needs to be specified.. + /// + public static string SubscriptionNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("SubscriptionNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription name {0} doesn't exist.. + /// + public static string SubscriptionNameNotFoundMessage + { + get + { + return ResourceManager.GetString("SubscriptionNameNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription needs to be specified.. + /// + public static string SubscriptionNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("SubscriptionNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Suspend. + /// + public static string Suspend + { + get + { + return ResourceManager.GetString("Suspend", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Swapping website production slot .... + /// + public static string SwappingWebsite + { + get + { + return ResourceManager.GetString("SwappingWebsite", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to swap the website '{0}' production slot with slot '{1}'?. + /// + public static string SwapWebsiteSlotWarning + { + get + { + return ResourceManager.GetString("SwapWebsiteSlotWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The Switch-AzureMode cmdlet is deprecated and will be removed in a future release.. + /// + public static string SwitchAzureModeDeprecated + { + get + { + return ResourceManager.GetString("SwitchAzureModeDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Starting cmdlet execution, setting for cmdlet confirmation required: '{0}'. + /// + public static string TraceBeginLROJob + { + get + { + return ResourceManager.GetString("TraceBeginLROJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Blocking job for ShouldMethod '{0}'. + /// + public static string TraceBlockLROThread + { + get + { + return ResourceManager.GetString("TraceBlockLROThread", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Completing cmdlet execution in RunJob. + /// + public static string TraceEndLROJob + { + get + { + return ResourceManager.GetString("TraceEndLROJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: State change from '{0}' to '{1}' because '{2}'. + /// + public static string TraceHandleLROStateChange + { + get + { + return ResourceManager.GetString("TraceHandleLROStateChange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Unblocking job due to stoppage or failure. + /// + public static string TraceHandlerCancelJob + { + get + { + return ResourceManager.GetString("TraceHandlerCancelJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Unblocking job that was previously blocked.. + /// + public static string TraceHandlerUnblockJob + { + get + { + return ResourceManager.GetString("TraceHandlerUnblockJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Error in cmdlet execution. + /// + public static string TraceLROJobException + { + get + { + return ResourceManager.GetString("TraceLROJobException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Removing state changed event handler, exception '{0}'. + /// + public static string TraceRemoveLROEventHandler + { + get + { + return ResourceManager.GetString("TraceRemoveLROEventHandler", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: ShouldMethod '{0}' unblocked.. + /// + public static string TraceUnblockLROThread + { + get + { + return ResourceManager.GetString("TraceUnblockLROThread", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to decode string from base 64. Please make sure the string is correctly encoded: {0}.. + /// + public static string UnableToDecodeBase64String + { + get + { + return ResourceManager.GetString("UnableToDecodeBase64String", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to update mismatching Json structured: {0} {1}.. + /// + public static string UnableToPatchJson + { + get + { + return ResourceManager.GetString("UnableToPatchJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provider {0} is unknown.. + /// + public static string UnknownProviderMessage + { + get + { + return ResourceManager.GetString("UnknownProviderMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Update. + /// + public static string Update + { + get + { + return ResourceManager.GetString("Update", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updated settings for subscription '{0}'. Current subscription is '{1}'.. + /// + public static string UpdatedSettings + { + get + { + return ResourceManager.GetString("UpdatedSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User name is not valid.. + /// + public static string UserNameIsNotValid + { + get + { + return ResourceManager.GetString("UserNameIsNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User name needs to be specified.. + /// + public static string UserNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("UserNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the VLan Id has to be provided.. + /// + public static string VlanIdRequired + { + get + { + return ResourceManager.GetString("VlanIdRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please wait.... + /// + public static string WaitMessage + { + get + { + return ResourceManager.GetString("WaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The azure storage emulator is not installed, skip launching.... + /// + public static string WarningWhenStorageEmulatorIsMissing + { + get + { + return ResourceManager.GetString("WarningWhenStorageEmulatorIsMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Web.cloud.config. + /// + public static string WebCloudConfig + { + get + { + return ResourceManager.GetString("WebCloudConfig", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to web.config. + /// + public static string WebConfigTemplateFileName + { + get + { + return ResourceManager.GetString("WebConfigTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MSDeploy. + /// + public static string WebDeployKeywordInWebSitePublishProfile + { + get + { + return ResourceManager.GetString("WebDeployKeywordInWebSitePublishProfile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot build the project successfully. Please see logs in {0}.. + /// + public static string WebProjectBuildFailTemplate + { + get + { + return ResourceManager.GetString("WebProjectBuildFailTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebRole. + /// + public static string WebRole + { + get + { + return ResourceManager.GetString("WebRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to setup_web.cmd > log.txt. + /// + public static string WebRoleStartupTaskCommandLine + { + get + { + return ResourceManager.GetString("WebRoleStartupTaskCommandLine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebRole.xml. + /// + public static string WebRoleTemplateFileName + { + get + { + return ResourceManager.GetString("WebRoleTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebSite with given name {0} already exists in the specified Subscription and Webspace.. + /// + public static string WebsiteAlreadyExists + { + get + { + return ResourceManager.GetString("WebsiteAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebSite with given name {0} already exists in the specified Subscription and Location.. + /// + public static string WebsiteAlreadyExistsReplacement + { + get + { + return ResourceManager.GetString("WebsiteAlreadyExistsReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Site {0} already has repository created for it.. + /// + public static string WebsiteRepositoryAlreadyExists + { + get + { + return ResourceManager.GetString("WebsiteRepositoryAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Workspaces/WebsiteExtension/Website/{0}/dashboard/. + /// + public static string WebsiteSufixUrl + { + get + { + return ResourceManager.GetString("WebsiteSufixUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://{0}/msdeploy.axd?site={1}. + /// + public static string WebSiteWebDeployUriTemplate + { + get + { + return ResourceManager.GetString("WebSiteWebDeployUriTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WorkerRole. + /// + public static string WorkerRole + { + get + { + return ResourceManager.GetString("WorkerRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to setup_worker.cmd > log.txt. + /// + public static string WorkerRoleStartupTaskCommandLine + { + get + { + return ResourceManager.GetString("WorkerRoleStartupTaskCommandLine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WorkerRole.xml. + /// + public static string WorkerRoleTemplateFileName + { + get + { + return ResourceManager.GetString("WorkerRoleTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to (x86). + /// + public static string x86InProgramFiles + { + get + { + return ResourceManager.GetString("x86InProgramFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Yes. + /// + public static string Yes + { + get + { + return ResourceManager.GetString("Yes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Yes, I agree. + /// + public static string YesHint + { + get + { + return ResourceManager.GetString("YesHint", resourceCulture); + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/Properties/Resources.resx b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Properties/Resources.resx similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/Properties/Resources.resx rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Properties/Resources.resx diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Response.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Response.cs new file mode 100644 index 00000000000..d7b5dbe744a --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Response.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + using System; + using System.Threading.Tasks; + public class Response : EventData + { + public Response() : base() + { + } + } + + public class Response : Response + { + private Func> _resultDelegate; + private Task _resultValue; + + public Response(T value) : base() => _resultValue = Task.FromResult(value); + public Response(Func value) : base() => _resultDelegate = () => Task.FromResult(value()); + public Response(Func> value) : base() => _resultDelegate = value; + public Task Result => _resultValue ?? (_resultValue = this._resultDelegate()); + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Serialization/JsonSerializer.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Serialization/JsonSerializer.cs new file mode 100644 index 00000000000..cc0e8ca5f14 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Serialization/JsonSerializer.cs @@ -0,0 +1,350 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal class JsonSerializer + { + private int depth = 0; + + private SerializationOptions options = new SerializationOptions(); + + #region Deserialization + + internal T Deseralize(JsonObject json) + where T : new() + { + var contract = JsonModelCache.Get(typeof(T)); + + return (T)DeserializeObject(contract, json); + } + + internal object DeserializeObject(JsonModel contract, JsonObject json) + { + var instance = Activator.CreateInstance(contract.Type); + + depth++; + + // Ensure we don't recurse forever + if (depth > 5) throw new Exception("Depth greater than 5"); + + foreach (var field in json) + { + var member = contract[field.Key]; + + if (member != null) + { + var value = DeserializeValue(member, field.Value); + + member.SetValue(instance, value); + } + } + + depth--; + + return instance; + } + + private object DeserializeValue(JsonMember member, JsonNode value) + { + if (value.Type == JsonType.Null) return null; + + var type = member.Type; + + if (member.IsStringLike && value.Type != JsonType.String) + { + // Take the long path... + return DeserializeObject(JsonModelCache.Get(type), (JsonObject)value); + } + else if (member.Converter != null) + { + return member.Converter.FromJson(value); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (member.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + private object DeserializeValue(Type type, JsonNode value) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + + if (value.Type == JsonType.Null) return null; + + var typeDetails = TypeDetails.Get(type); + + if (typeDetails.JsonConverter != null) + { + return typeDetails.JsonConverter.FromJson(value); + } + else if (typeDetails.IsEnum) + { + return Enum.Parse(type, value.ToString(), ignoreCase: true); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (typeDetails.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + internal Array DeserializeArray(Type type, JsonArray elements) + { + var elementType = type.GetElementType(); + + var elementTypeDetails = TypeDetails.Get(elementType); + + var array = Array.CreateInstance(elementType, elements.Count); + + int i = 0; + + if (elementTypeDetails.JsonConverter != null) + { + foreach (var value in elements) + { + array.SetValue(elementTypeDetails.JsonConverter.FromJson(value), i); + + i++; + } + } + else + { + foreach (var value in elements) + { + array.SetValue(DeserializeValue(elementType, value), i); + + i++; + } + } + + return array; + } + + internal IList DeserializeList(Type type, JsonArray jsonArray) + { + // TODO: Handle non-generic types + if (!type.IsGenericType) + throw new ArgumentException("Must be a generic type", nameof(type)); + + var elementType = type.GetGenericArguments()[0]; + + IList list; + + if (type.IsInterface) + { + // Create a concrete generic list + list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); + } + else + { + list = (IList)Activator.CreateInstance(type); + } + + foreach (var value in jsonArray) + { + list.Add(DeserializeValue(elementType, value)); + } + + return list; + } + + #endregion + + #region Serialization + + internal JsonNode Serialize(object instance) => + Serialize(instance, SerializationOptions.Default); + + internal JsonNode Serialize(object instance, string[] include) => + Serialize(instance, new SerializationOptions { Include = include }); + + internal JsonNode Serialize(object instance, SerializationOptions options) + { + this.options = options; + + if (instance == null) + { + return XNull.Instance; + } + + return ReadValue(instance.GetType(), instance); + } + + #region Readers + + internal JsonArray ReadArray(IEnumerable collection) + { + var array = new XNodeArray(); + + foreach (var item in collection) + { + array.Add(ReadValue(item.GetType(), item)); + } + + return array; + } + + internal IEnumerable> ReadProperties(object instance) + { + var contract = JsonModelCache.Get(instance.GetType()); + + foreach (var member in contract.Members) + { + string name = member.Name; + + if (options.PropertyNameTransformer != null) + { + name = options.PropertyNameTransformer.Invoke(name); + } + + // Skip the field if it's not included + if ((depth == 1 && !options.IsIncluded(name))) + { + continue; + } + + var value = member.GetValue(instance); + + if (!member.EmitDefaultValue && (value == null || (member.IsList && ((IList)value).Count == 0) || value.Equals(member.DefaultValue))) + { + continue; + } + else if (options.IgnoreNullValues && value == null) // Ignore null values + { + continue; + } + + // Transform the value if there is one + if (options.Transformations != null) + { + var transform = options.GetTransformation(name); + + if (transform != null) + { + value = transform.Transformer(value); + } + } + + yield return new KeyValuePair(name, ReadValue(member.TypeDetails, value)); + } + } + + private JsonObject ReadObject(object instance) + { + depth++; + + // TODO: Guard against a self referencing graph + if (depth > options.MaxDepth) + { + depth--; + + return new JsonObject(); + } + + var node = new JsonObject(ReadProperties(instance)); + + depth--; + + return node; + } + + private JsonNode ReadValue(Type type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + var member = TypeDetails.Get(type); + + return ReadValue(member, value); + } + + private JsonNode ReadValue(TypeDetails type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + if (type.JsonConverter != null) + { + return type.JsonConverter.ToJson(value); + } + else if (type.IsArray) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateArray((string[])value); + case TypeCode.UInt16: return CreateArray((ushort[])value); + case TypeCode.UInt32: return CreateArray((uint[])value); + case TypeCode.UInt64: return CreateArray((ulong[])value); + case TypeCode.Int16: return CreateArray((short[])value); + case TypeCode.Int32: return CreateArray((int[])value); + case TypeCode.Int64: return CreateArray((long[])value); + case TypeCode.Single: return CreateArray((float[])value); + case TypeCode.Double: return CreateArray((double[])value); + default: return ReadArray((IEnumerable)value); + } + } + else if (value is IEnumerable) + { + if (type.IsList && type.ElementType != null) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateList(value); + case TypeCode.UInt16: return CreateList(value); + case TypeCode.UInt32: return CreateList(value); + case TypeCode.UInt64: return CreateList(value); + case TypeCode.Int16: return CreateList(value); + case TypeCode.Int32: return CreateList(value); + case TypeCode.Int64: return CreateList(value); + case TypeCode.Single: return CreateList(value); + case TypeCode.Double: return CreateList(value); + } + } + + return ReadArray((IEnumerable)value); + } + else + { + // Complex object + return ReadObject(value); + } + } + + private XList CreateList(object value) => new XList((IList)value); + + private XImmutableArray CreateArray(T[] array) => new XImmutableArray(array); + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Serialization/PropertyTransformation.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Serialization/PropertyTransformation.cs new file mode 100644 index 00000000000..84e9a764a52 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Serialization/PropertyTransformation.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal class PropertyTransformation + { + internal PropertyTransformation(string name, Func transformer) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Transformer = transformer ?? throw new ArgumentNullException(nameof(transformer)); + } + + internal string Name { get; } + + internal Func Transformer { get; } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Serialization/SerializationOptions.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Serialization/SerializationOptions.cs new file mode 100644 index 00000000000..1b3404e2557 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Serialization/SerializationOptions.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * 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.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal class SerializationOptions + { + internal static readonly SerializationOptions Default = new SerializationOptions(); + + internal SerializationOptions() { } + + internal SerializationOptions( + string[] include = null, + bool ingoreNullValues = false) + { + Include = include; + IgnoreNullValues = ingoreNullValues; + } + + internal string[] Include { get; set; } + + internal string[] Exclude { get; set; } + + internal bool IgnoreNullValues { get; set; } + + internal PropertyTransformation[] Transformations { get; set; } + + internal Func PropertyNameTransformer { get; set; } + + internal int MaxDepth { get; set; } = 5; + + internal bool IsIncluded(string name) + { + if (Exclude != null) + { + return !Exclude.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + else if (Include != null) + { + return Include.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + + return true; + } + + internal PropertyTransformation GetTransformation(string propertyName) + { + if (Transformations == null) return null; + + foreach (var t in Transformations) + { + if (t.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase)) + { + return t; + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/SerializationMode.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/SerializationMode.cs new file mode 100644 index 00000000000..e1737b96ef6 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/SerializationMode.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + [System.Flags] + public enum SerializationMode + { + None = 0, + IncludeHeaders = 1 << 0, + 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/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/TypeConverterExtensions.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/TypeConverterExtensions.cs new file mode 100644 index 00000000000..3402c728cf4 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/TypeConverterExtensions.cs @@ -0,0 +1,261 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.PowerShell +{ + internal static class TypeConverterExtensions + { + internal static T[] SelectToArray(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) }; + } +#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]; // 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.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) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Management.Automation.PSObject instance) + { + if (null != instance) + { + foreach (var each in instance.Properties) + { + yield return each; + } + } + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.Generic.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys.OfType() + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Management.Automation.PSObject instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + // new global::System.Collections.Generic.HashSet(System.StringComparer.InvariantCultureIgnoreCase) + return (null == instance || !instance.Properties.Any()) ? + Enumerable.Empty>() : + instance.Properties + .Where(property => + !(true == exclusions?.Contains(property.Name)) + && (false != inclusions?.Contains(property.Name))) + .Select(property => new System.Collections.Generic.KeyValuePair(property.Name, property.Value)); + } + + + internal static T GetValueForProperty(this System.Collections.Generic.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys, each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + internal static T GetValueForProperty(this System.Collections.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys.OfType(), each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static T GetValueForProperty(this System.Management.Automation.PSObject psObject, string propertyName, T defaultValue, System.Func converter) + { + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return property == null ? defaultValue : (T)converter(property.Value); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static bool Contains(this System.Management.Automation.PSObject psObject, string propertyName) + { + bool result = false; + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + result = property == null ? false : true; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return result; + } + } +} diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/UndeclaredResponseException.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/UndeclaredResponseException.cs new file mode 100644 index 00000000000..ffdce426eaf --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/UndeclaredResponseException.cs @@ -0,0 +1,112 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + using System; + using System.Net.Http; + using System.Net.Http.Headers; + using static Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Extensions; + + public class RestException : Exception, IDisposable + { + public System.Net.HttpStatusCode StatusCode { get; set; } + public string Code { get; protected set; } + protected string message; + public HttpRequestMessage RequestMessage { get; protected set; } + public HttpResponseHeaders ResponseHeaders { get; protected set; } + + public string ResponseBody { get; protected set; } + public string ClientRequestId { get; protected set; } + public string RequestId { get; protected set; } + + public override string Message => message; + public string Action { get; protected set; } + + public RestException(System.Net.Http.HttpResponseMessage response) + { + StatusCode = response.StatusCode; + //CloneWithContent will not work here since the content is disposed after sendAsync + //Besides, it seems there is no need for the request content cloned here. + RequestMessage = response.RequestMessage.Clone(); + ResponseBody = response.Content.ReadAsStringAsync().Result; + ResponseHeaders = response.Headers; + + RequestId = response.GetFirstHeader("x-ms-request-id"); + ClientRequestId = response.GetFirstHeader("x-ms-client-request-id"); + + try + { + // try to parse the body as JSON, and see if a code and message are in there. + var json = Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonNode.Parse(ResponseBody) as Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json.JsonObject; + + // error message could be in properties.statusMessage + { message = If(json?.Property("properties"), out var p) + && If(p?.PropertyT("statusMessage"), out var sm) + ? (string)sm : (string)Message; } + + // see if there is an error block in the body + json = json?.Property("error") ?? json; + + { Code = If(json?.PropertyT("code"), out var c) ? (string)c : (string)StatusCode.ToString(); } + { message = If(json?.PropertyT("message"), out var m) ? (string)m : (string)Message; } + { Action = If(json?.PropertyT("action"), out var a) ? (string)a : (string)Action; } + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // couldn't get the code/message from the body response. + // In this case, we will assume the response is the expected error message + if(!string.IsNullOrEmpty(ResponseBody)) { + message = ResponseBody; + } + } +#endif + if (string.IsNullOrEmpty(message)) + { + if (StatusCode >= System.Net.HttpStatusCode.BadRequest && StatusCode < System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Request Error, Status: {StatusCode}"; + } + else if (StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Server Error, Status: {StatusCode}"; + } + else + { + message = $"The server responded with an unrecognized response, Status: {StatusCode}"; + } + } + } + + public void Dispose() + { + ((IDisposable)RequestMessage).Dispose(); + } + } + + public class RestException : RestException + { + public T Error { get; protected set; } + public RestException(System.Net.Http.HttpResponseMessage response, T error) : base(response) + { + Error = error; + } + } + + + public class UndeclaredResponseException : RestException + { + public UndeclaredResponseException(System.Net.Http.HttpResponseMessage response) : base(response) + { + + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Writers/JsonWriter.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Writers/JsonWriter.cs new file mode 100644 index 00000000000..da83c92955f --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/Writers/JsonWriter.cs @@ -0,0 +1,223 @@ +/*--------------------------------------------------------------------------------------------- + * 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; +using System.IO; +using System.Web; + +namespace Microsoft.Azure.PowerShell.Cmdlets.DataBox.Runtime.Json +{ + internal class JsonWriter + { + const string indentation = " "; // 2 spaces + + private readonly bool pretty; + private readonly TextWriter writer; + + protected int currentLevel = 0; + + internal JsonWriter(TextWriter writer, bool pretty = true) + { + this.writer = writer ?? throw new ArgumentNullException(nameof(writer)); + this.pretty = pretty; + } + + internal void WriteNode(JsonNode node) + { + switch (node.Type) + { + case JsonType.Array: WriteArray((IEnumerable)node); break; + case JsonType.Object: WriteObject((JsonObject)node); break; + + // Primitives + case JsonType.Binary: WriteBinary((XBinary)node); break; + case JsonType.Boolean: WriteBoolean((bool)node); break; + case JsonType.Date: WriteDate((JsonDate)node); break; + case JsonType.Null: WriteNull(); break; + case JsonType.Number: WriteNumber((JsonNumber)node); break; + case JsonType.String: WriteString(node); break; + } + } + + internal void WriteArray(IEnumerable array) + { + currentLevel++; + + writer.Write('['); + + bool doIndentation = false; + + if (pretty) + { + foreach (var node in array) + { + if (node.Type == JsonType.Object || node.Type == JsonType.Array) + { + doIndentation = true; + + break; + } + } + } + + bool isFirst = true; + + foreach (JsonNode node in array) + { + if (!isFirst) writer.Write(','); + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + WriteNode(node); + + isFirst = false; + } + + currentLevel--; + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + writer.Write(']'); + } + + internal void WriteIndent() + { + if (pretty) + { + writer.Write(Environment.NewLine); + + for (int level = 0; level < currentLevel; level++) + { + writer.Write(indentation); + } + } + } + + internal void WriteObject(JsonObject obj) + { + currentLevel++; + + writer.Write('{'); + + bool isFirst = true; + + foreach (var field in obj) + { + if (!isFirst) writer.Write(','); + + WriteIndent(); + + WriteFieldName(field.Key); + + writer.Write(':'); + + if (pretty) + { + writer.Write(' '); + } + + // Write the field value + WriteNode(field.Value); + + isFirst = false; + } + + currentLevel--; + + WriteIndent(); + + writer.Write('}'); + } + + internal void WriteFieldName(string fieldName) + { + writer.Write('"'); + writer.Write(HttpUtility.JavaScriptStringEncode(fieldName)); + writer.Write('"'); + } + + #region Primitives + + internal void WriteBinary(XBinary value) + { + writer.Write('"'); + writer.Write(value.ToString()); + writer.Write('"'); + } + + internal void WriteBoolean(bool value) + { + writer.Write(value ? "true" : "false"); + } + + internal void WriteDate(JsonDate date) + { + if (date.ToDateTime().Year == 1) + { + WriteNull(); + } + else + { + writer.Write('"'); + writer.Write(date.ToIsoString()); + writer.Write('"'); + } + } + + internal void WriteNull() + { + writer.Write("null"); + } + + internal void WriteNumber(JsonNumber number) + { + if (number.Overflows) + { + writer.Write('"'); + writer.Write(number.Value); + writer.Write('"'); + } + else + { + writer.Write(number.Value); + } + } + + internal void WriteString(string text) + { + if (text == null) + { + WriteNull(); + } + else + { + writer.Write('"'); + + writer.Write(HttpUtility.JavaScriptStringEncode(text)); + + writer.Write('"'); + } + } + + #endregion + } +} + + +// TODO: Replace with System.Text.Json when available diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/delegates.cs b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/delegates.cs new file mode 100644 index 00000000000..b6405d8ca7e --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/generated/runtime/delegates.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * 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.DataBox.Runtime +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData=System.Func; + + public delegate Task SendAsync(HttpRequestMessage request, IEventListener callback); + public delegate Task SendAsyncStep(HttpRequestMessage request, IEventListener callback, ISendAsync next); + public delegate Task SignalEvent(string id, CancellationToken token, GetEventData getEventData); + public delegate Task Event(EventData message); + public delegate void SynchEvent(EventData message); + public delegate Task OnResponse(Response message); + public delegate Task OnResponse(Response message); +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/how-to.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/how-to.md new file mode 100644 index 00000000000..00e86c09510 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/how-to.md @@ -0,0 +1,58 @@ +# How-To +This document describes how to develop for `Az.DataBox`. + +## Building `Az.DataBox` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [README.md](exports/README.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [README.md](custom/README.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [README.md](examples/README.md) in the `examples` folder. To read more about documentation, look at the [README.md](docs/README.md) in the `docs` folder. + +## Testing `Az.DataBox` +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder. + +## Packing `Az.DataBox` +To pack `Az.DataBox` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.DataBox`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.DataBox.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.DataBox.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.DataBox`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.DataBox` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/internal/Az.DataBox.internal.psm1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/internal/Az.DataBox.internal.psm1 new file mode 100644 index 00000000000..b79898e4845 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/internal/Az.DataBox.internal.psm1 @@ -0,0 +1,38 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.DataBox.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.DataBox.Module]::Instance + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = $PSScriptRoot + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } +# endregion diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/internal/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/internal/README.md new file mode 100644 index 00000000000..e1342595dbb --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/internal/README.md @@ -0,0 +1,14 @@ +# Internal +This directory contains a module to handle *internal only* cmdlets. Cmdlets that you **hide** in configuration are created here. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest.powershell/blob/main/docs/directives.md#cmdlet-hiding-exportation-suppression). The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The `Az.DataBox.internal.psm1` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `Az.DataBox`. Instead, this sub-module is imported by the `..\custom\Az.DataBox.custom.psm1` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `Az.DataBox.internal\Get-Example` would call an internal cmdlet named `Get-Example`. + +## Purpose +This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `Az.DataBox`. diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/license.txt b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/license.txt similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/license.txt rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/license.txt diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/pack-module.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/pack-module.ps1 similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/pack-module.ps1 rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/pack-module.ps1 diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/resources/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/resources/README.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/resources/README.md rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/resources/README.md diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/run-module.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/run-module.ps1 new file mode 100644 index 00000000000..f17cb68ca5d --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/run-module.ps1 @@ -0,0 +1,62 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated, [switch]$Code) +$ErrorActionPreference = 'Stop' + +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 -NotIsolated + return +} + +$isAzure = $true +if($isAzure) { + . (Join-Path $PSScriptRoot 'check-dependencies.ps1') -NotIsolated -Accounts + # Load the latest version of Az.Accounts installed + Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.DataBox.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +function Prompt { + Write-Host -NoNewline -ForegroundColor Green "PS $(Get-Location)" + Write-Host -NoNewline -ForegroundColor Gray ' [' + Write-Host -NoNewline -ForegroundColor White -BackgroundColor DarkCyan $moduleName + ']> ' +} + +# where we would find the launch.json file +$vscodeDirectory = New-Item -ItemType Directory -Force -Path (Join-Path $PSScriptRoot '.vscode') +$launchJson = Join-Path $vscodeDirectory 'launch.json' + +# if there is a launch.json file, let's just assume -Code, and update the file +if(($Code) -or (test-Path $launchJson) ) { + $launchContent = '{ "version": "0.2.0", "configurations":[{ "name":"Attach to PowerShell", "type":"coreclr", "request":"attach", "processId":"' + ([System.Diagnostics.Process]::GetCurrentProcess().Id) + '", "justMyCode":false }] }' + Set-Content -Path $launchJson -Value $launchContent + if($Code) { + # only launch vscode if they say -code + code $PSScriptRoot + } +} + +Import-Module -Name $modulePath \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/target/test-module.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/test-module.ps1 new file mode 100644 index 00000000000..01b13d5d049 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/test-module.ps1 @@ -0,0 +1,98 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated, [switch]$Live, [switch]$Record, [switch]$Playback, [switch]$RegenerateSupportModule, [switch]$UsePreviousConfigForRecord, [string[]]$TestName) +$ErrorActionPreference = 'Stop' + +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 -NotIsolated + return +} + +# This is a workaround, since for string array parameter, pwsh -File will only take the first element +if ($PSBoundParameters.ContainsKey("TestName") -and ($TestName.count -eq 1) -and ($TestName[0].Contains(','))) { + $TestName = $TestName[0].Split(",") +} + +$ProgressPreference = 'SilentlyContinue' +$baseName = $PSScriptRoot.BaseName +$requireResourceModule = (($baseName -ne "Resources") -and ($Record.IsPresent -or $Live.IsPresent)) +. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -NotIsolated -Accounts:$false -Pester -Resources:$requireResourceModule -RegenerateSupportModule:$RegenerateSupportModule +. ("$PSScriptRoot\test\utils.ps1") + +if ($requireResourceModule) +{ + # Load the latest Az.Accounts installed + Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version + $resourceModulePSD = Get-Item -Path (Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psd1') + Import-Module -Name $resourceModulePSD.FullName +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) +{ + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.DataBox.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +Import-Module -Name Pester +Import-Module -Name $modulePath + +$TestMode = 'playback' +$ExcludeTag = @("LiveOnly") +if($Live) +{ + $TestMode = 'live' + $ExcludeTag = @() +} +if($Record) +{ + $TestMode = 'record' +} +try +{ + if ($TestMode -ne 'playback') + { + setupEnv + } else { + $env:AzPSAutorestTestPlaybackMode = $true + } + $testFolder = Join-Path $PSScriptRoot 'test' + if ($null -ne $TestName) + { + Invoke-Pester -Script @{ Path = $testFolder } -TestName $TestName -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") + } else { + Invoke-Pester -Script @{ Path = $testFolder } -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") + } +} Finally +{ + if ($TestMode -ne 'playback') + { + cleanupEnv + } + else { + $env:AzPSAutorestTestPlaybackMode = '' + } +} + +Write-Host -ForegroundColor Green '-------------Done-------------' diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/test/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/test/README.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/test/README.md rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/test/README.md diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/test/loadEnv.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/test/loadEnv.ps1 similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/test/loadEnv.ps1 rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/test/loadEnv.ps1 diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/.gitattributes b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/.gitattributes similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/.gitattributes rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/.gitattributes diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/README.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/README.md rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/README.md diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/custom/New-AzDeployment.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/custom/New-AzDeployment.ps1 similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/custom/New-AzDeployment.ps1 rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/custom/New-AzDeployment.ps1 diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/docs/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/docs/README.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/docs/README.md rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/docs/README.md diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/examples/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/examples/README.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/examples/README.md rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/examples/README.md diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/how-to.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/how-to.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/how-to.md rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/how-to.md diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/license.txt b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/license.txt similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/license.txt rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/license.txt diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/resources/CmdletSurface-latest-2019-04-30.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/resources/CmdletSurface-latest-2019-04-30.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/resources/CmdletSurface-latest-2019-04-30.md rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/resources/CmdletSurface-latest-2019-04-30.md diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/resources/ModelSurface.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/resources/ModelSurface.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/resources/ModelSurface.md rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/resources/ModelSurface.md diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/resources/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/resources/README.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/resources/README.md rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/resources/README.md diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/test/README.md b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/test/README.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/test/README.md rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/tools/Resources/test/README.md diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/utils/Get-SubscriptionIdTestSafe.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/utils/Get-SubscriptionIdTestSafe.ps1 similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/utils/Get-SubscriptionIdTestSafe.ps1 rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/utils/Get-SubscriptionIdTestSafe.ps1 diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/utils/Unprotect-SecureString.ps1 b/tests-upgrade/tests-emitter/DataBox.Management.brown/target/utils/Unprotect-SecureString.ps1 similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/utils/Unprotect-SecureString.ps1 rename to tests-upgrade/tests-emitter/DataBox.Management.brown/target/utils/Unprotect-SecureString.ps1 diff --git a/tests-upgrade/tests-emitter/DataBox.Management.brown/tspconfig.yaml b/tests-upgrade/tests-emitter/DataBox.Management.brown/tspconfig.yaml new file mode 100644 index 00000000000..40944c4b449 --- /dev/null +++ b/tests-upgrade/tests-emitter/DataBox.Management.brown/tspconfig.yaml @@ -0,0 +1,82 @@ +parameters: + "service-dir": + default: "sdk/databox" +emit: + - "@azure-tools/typespec-autorest" +options: + "@azure-tools/typespec-autorest": + use-read-only-status-schema: true + emitter-output-dir: "{project-root}" + azure-resource-provider-folder: "resource-manager" + output-file: "{version-status}/{version}/databox.json" + examples-dir: "{project-root}/examples" + arm-types-dir: "{project-root}/../../../../common-types/resource-management" + + emit-lro-options: "all" + "@azure-tools/typespec-csharp": + flavor: azure + emitter-output-dir: "{output-dir}/{service-dir}/{namespace}" + clear-output-folder: true + model-namespace: true + namespace: "Azure.ResourceManager.DataBox" + "@azure-tools/typespec-python": + emitter-output-dir: "{output-dir}/{service-dir}/azure-mgmt-databox" + namespace: "azure.mgmt.databox" + generate-test: true + generate-sample: true + flavor: "azure" + "@azure-tools/typespec-java": + emitter-output-dir: "{output-dir}/{service-dir}/azure-resourcemanager-databox" + namespace: "com.azure.resourcemanager.databox" + service-name: "Data Box" # human-readable service name, whitespace allowed + flavor: azure + use-object-for-unknown: true + "@azure-tools/typespec-ts": + emitter-output-dir: "{output-dir}/{service-dir}/arm-databox" + flavor: azure + experimental-extensible-enums: true + package-details: + name: "@azure/arm-databox" + "@azure-tools/typespec-go": + service-dir: "sdk/resourcemanager/databox" + emitter-output-dir: "{output-dir}/{service-dir}/armdatabox" + module: "github.com/Azure/azure-sdk-for-go/{service-dir}/armdatabox" + fix-const-stuttering: true + flavor: "azure" + generate-samples: true + generate-fakes: true + head-as-boolean: true + inject-spans: true + "@azure-tools/typespec-powershell": + service-dir: "src" + package-dir: "DataBox/DataBox.Autorest" + clear-output-folder: true + azure: true + module-version: 0.1.0 + prefix: 'Az' + subject-prefix: 'DataBox' + service-name: DataBox + module-name: "{prefix}.{service-name}" + exclude-tableview-properties: + - Id + - Type + disable-transform-identity-type-for-operation: + - Jobs_Update + directive: + - where: + subject: Operation + hide: true + - where: + parameter-name: SubscriptionId + set: + default: + script: '(Get-AzContext).Subscription.Id' + - where: + variant: ^(Create|Update)(?!.*?Expanded|ViaJsonString|ViaJsonFilePath) + remove: true + - where: + variant: ^CreateViaIdentity.*$ + remove: true +linter: + extends: + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/Agent.tsp b/tests-upgrade/tests-emitter/StorageMover.Management.brown/Agent.tsp similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/Agent.tsp rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/Agent.tsp diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/Endpoint.tsp b/tests-upgrade/tests-emitter/StorageMover.Management.brown/Endpoint.tsp similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/Endpoint.tsp rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/Endpoint.tsp diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/JobDefinition.tsp b/tests-upgrade/tests-emitter/StorageMover.Management.brown/JobDefinition.tsp similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/JobDefinition.tsp rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/JobDefinition.tsp diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/JobRun.tsp b/tests-upgrade/tests-emitter/StorageMover.Management.brown/JobRun.tsp similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/JobRun.tsp rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/JobRun.tsp diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/Project.tsp b/tests-upgrade/tests-emitter/StorageMover.Management.brown/Project.tsp similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/Project.tsp rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/Project.tsp diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/StorageMover.tsp b/tests-upgrade/tests-emitter/StorageMover.Management.brown/StorageMover.tsp similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/StorageMover.tsp rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/StorageMover.tsp diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/back-compatible.tsp b/tests-upgrade/tests-emitter/StorageMover.Management.brown/back-compatible.tsp similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/back-compatible.tsp rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/back-compatible.tsp diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/client.tsp b/tests-upgrade/tests-emitter/StorageMover.Management.brown/client.tsp similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/client.tsp rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/client.tsp diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_CreateOrUpdate_MaximumSet.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_CreateOrUpdate_MaximumSet.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_CreateOrUpdate_MaximumSet.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_CreateOrUpdate_MaximumSet.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_CreateOrUpdate_MinimumSet.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_CreateOrUpdate_MinimumSet.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_CreateOrUpdate_MinimumSet.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_CreateOrUpdate_MinimumSet.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_CreateOrUpdate_UploadLimitSchedule_Overnight.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_CreateOrUpdate_UploadLimitSchedule_Overnight.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_CreateOrUpdate_UploadLimitSchedule_Overnight.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_CreateOrUpdate_UploadLimitSchedule_Overnight.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_Delete.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_Delete.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_Delete.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_Delete.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_Get_MaximumSet.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_Get_MaximumSet.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_Get_MaximumSet.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_Get_MaximumSet.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_Get_MinimumSet.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_Get_MinimumSet.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_Get_MinimumSet.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_Get_MinimumSet.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_List_MaximumSet.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_List_MaximumSet.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_List_MaximumSet.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_List_MaximumSet.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_List_MinimumSet.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_List_MinimumSet.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_List_MinimumSet.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_List_MinimumSet.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_Update.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_Update.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Agents_Update.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Agents_Update.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_CreateOrUpdate_AzureStorageBlobContainer.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_CreateOrUpdate_AzureStorageBlobContainer.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_CreateOrUpdate_AzureStorageBlobContainer.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_CreateOrUpdate_AzureStorageBlobContainer.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_CreateOrUpdate_AzureStorageSmbFileShare.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_CreateOrUpdate_AzureStorageSmbFileShare.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_CreateOrUpdate_AzureStorageSmbFileShare.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_CreateOrUpdate_AzureStorageSmbFileShare.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_CreateOrUpdate_NfsMount.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_CreateOrUpdate_NfsMount.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_CreateOrUpdate_NfsMount.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_CreateOrUpdate_NfsMount.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_CreateOrUpdate_SmbMount.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_CreateOrUpdate_SmbMount.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_CreateOrUpdate_SmbMount.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_CreateOrUpdate_SmbMount.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Delete.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Delete.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Delete.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Delete.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Get_AzureStorageBlobContainer.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Get_AzureStorageBlobContainer.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Get_AzureStorageBlobContainer.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Get_AzureStorageBlobContainer.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Get_AzureStorageSmbFileShare.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Get_AzureStorageSmbFileShare.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Get_AzureStorageSmbFileShare.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Get_AzureStorageSmbFileShare.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Get_NfsMount.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Get_NfsMount.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Get_NfsMount.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Get_NfsMount.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Get_SmbMount.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Get_SmbMount.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Get_SmbMount.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Get_SmbMount.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_List.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_List.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_List.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_List.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Update_AzureStorageBlobContainer.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Update_AzureStorageBlobContainer.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Update_AzureStorageBlobContainer.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Update_AzureStorageBlobContainer.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Update_AzureStorageSmbFileShare.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Update_AzureStorageSmbFileShare.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Update_AzureStorageSmbFileShare.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Update_AzureStorageSmbFileShare.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Update_NfsMount.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Update_NfsMount.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Update_NfsMount.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Update_NfsMount.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Update_SmbMount.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Update_SmbMount.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Endpoints_Update_SmbMount.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Endpoints_Update_SmbMount.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_CreateOrUpdate.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_CreateOrUpdate.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_CreateOrUpdate.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_CreateOrUpdate.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_Delete.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_Delete.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_Delete.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_Delete.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_Get.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_Get.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_Get.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_Get.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_List.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_List.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_List.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_List.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_StartJob.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_StartJob.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_StartJob.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_StartJob.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_StopJob.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_StopJob.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_StopJob.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_StopJob.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_Update.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_Update.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobDefinitions_Update.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobDefinitions_Update.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobRuns_Get.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobRuns_Get.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobRuns_Get.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobRuns_Get.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobRuns_List.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobRuns_List.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/JobRuns_List.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/JobRuns_List.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Operations_List.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Operations_List.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Operations_List.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Operations_List.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Projects_CreateOrUpdate.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Projects_CreateOrUpdate.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Projects_CreateOrUpdate.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Projects_CreateOrUpdate.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Projects_Delete.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Projects_Delete.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Projects_Delete.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Projects_Delete.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Projects_Get.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Projects_Get.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Projects_Get.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Projects_Get.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Projects_List.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Projects_List.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Projects_List.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Projects_List.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Projects_Update.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Projects_Update.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/Projects_Update.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/Projects_Update.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/StorageMovers_CreateOrUpdate.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/StorageMovers_CreateOrUpdate.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/StorageMovers_CreateOrUpdate.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/StorageMovers_CreateOrUpdate.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/StorageMovers_Delete.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/StorageMovers_Delete.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/StorageMovers_Delete.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/StorageMovers_Delete.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/StorageMovers_Get.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/StorageMovers_Get.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/StorageMovers_Get.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/StorageMovers_Get.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/StorageMovers_List.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/StorageMovers_List.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/StorageMovers_List.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/StorageMovers_List.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/StorageMovers_ListBySubscription.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/StorageMovers_ListBySubscription.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/StorageMovers_ListBySubscription.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/StorageMovers_ListBySubscription.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/StorageMovers_Update.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/StorageMovers_Update.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2024-07-01/StorageMovers_Update.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2024-07-01/StorageMovers_Update.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_CreateOrUpdate_MaximumSet.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_CreateOrUpdate_MaximumSet.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_CreateOrUpdate_MaximumSet.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_CreateOrUpdate_MaximumSet.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_CreateOrUpdate_MinimumSet.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_CreateOrUpdate_MinimumSet.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_CreateOrUpdate_MinimumSet.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_CreateOrUpdate_MinimumSet.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_CreateOrUpdate_UploadLimitSchedule_Overnight.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_CreateOrUpdate_UploadLimitSchedule_Overnight.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_CreateOrUpdate_UploadLimitSchedule_Overnight.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_CreateOrUpdate_UploadLimitSchedule_Overnight.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_Delete.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_Delete.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_Delete.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_Delete.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_Get_MaximumSet.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_Get_MaximumSet.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_Get_MaximumSet.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_Get_MaximumSet.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_Get_MinimumSet.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_Get_MinimumSet.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_Get_MinimumSet.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_Get_MinimumSet.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_List_MaximumSet.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_List_MaximumSet.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_List_MaximumSet.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_List_MaximumSet.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_List_MinimumSet.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_List_MinimumSet.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_List_MinimumSet.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_List_MinimumSet.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_Update.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_Update.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Agents_Update.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Agents_Update.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureMultiCloudConnector.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureMultiCloudConnector.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureMultiCloudConnector.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureMultiCloudConnector.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageBlobContainer.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageBlobContainer.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageBlobContainer.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageBlobContainer.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageNfsFileShare.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageNfsFileShare.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageNfsFileShare.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageNfsFileShare.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageSmbFileShare.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageSmbFileShare.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageSmbFileShare.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_CreateOrUpdate_AzureStorageSmbFileShare.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_CreateOrUpdate_NfsMount.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_CreateOrUpdate_NfsMount.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_CreateOrUpdate_NfsMount.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_CreateOrUpdate_NfsMount.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_CreateOrUpdate_SmbMount.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_CreateOrUpdate_SmbMount.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_CreateOrUpdate_SmbMount.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_CreateOrUpdate_SmbMount.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Delete.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Delete.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Delete.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Delete.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Get_AzureMultiCloudConnector.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Get_AzureMultiCloudConnector.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Get_AzureMultiCloudConnector.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Get_AzureMultiCloudConnector.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Get_AzureStorageBlobContainer.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Get_AzureStorageBlobContainer.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Get_AzureStorageBlobContainer.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Get_AzureStorageBlobContainer.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Get_AzureStorageNfsFileShare.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Get_AzureStorageNfsFileShare.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Get_AzureStorageNfsFileShare.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Get_AzureStorageNfsFileShare.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Get_AzureStorageSmbFileShare.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Get_AzureStorageSmbFileShare.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Get_AzureStorageSmbFileShare.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Get_AzureStorageSmbFileShare.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Get_NfsMount.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Get_NfsMount.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Get_NfsMount.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Get_NfsMount.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Get_SmbMount.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Get_SmbMount.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Get_SmbMount.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Get_SmbMount.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_List.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_List.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_List.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_List.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Update_AzureMultiCloudConnector.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Update_AzureMultiCloudConnector.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Update_AzureMultiCloudConnector.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Update_AzureMultiCloudConnector.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Update_AzureStorageBlobContainer.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Update_AzureStorageBlobContainer.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Update_AzureStorageBlobContainer.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Update_AzureStorageBlobContainer.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Update_AzureStorageNfsFileShare.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Update_AzureStorageNfsFileShare.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Update_AzureStorageNfsFileShare.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Update_AzureStorageNfsFileShare.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Update_AzureStorageSmbFileShare.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Update_AzureStorageSmbFileShare.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Update_AzureStorageSmbFileShare.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Update_AzureStorageSmbFileShare.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Update_NfsMount.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Update_NfsMount.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Update_NfsMount.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Update_NfsMount.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Update_SmbMount.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Update_SmbMount.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Endpoints_Update_SmbMount.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Endpoints_Update_SmbMount.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_CreateOrUpdate.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_CreateOrUpdate.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_CreateOrUpdate.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_CreateOrUpdate.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_CreateOrUpdate_CloudToCloud.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_CreateOrUpdate_CloudToCloud.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_CreateOrUpdate_CloudToCloud.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_CreateOrUpdate_CloudToCloud.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_Delete.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_Delete.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_Delete.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_Delete.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_Get.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_Get.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_Get.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_Get.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_List.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_List.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_List.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_List.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_StartJob.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_StartJob.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_StartJob.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_StartJob.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_StopJob.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_StopJob.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_StopJob.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_StopJob.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_Update.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_Update.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobDefinitions_Update.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobDefinitions_Update.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobRuns_Get.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobRuns_Get.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobRuns_Get.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobRuns_Get.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobRuns_List.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobRuns_List.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/JobRuns_List.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/JobRuns_List.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Operations_List.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Operations_List.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Operations_List.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Operations_List.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Projects_CreateOrUpdate.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Projects_CreateOrUpdate.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Projects_CreateOrUpdate.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Projects_CreateOrUpdate.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Projects_Delete.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Projects_Delete.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Projects_Delete.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Projects_Delete.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Projects_Get.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Projects_Get.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Projects_Get.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Projects_Get.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Projects_List.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Projects_List.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Projects_List.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Projects_List.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Projects_Update.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Projects_Update.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/Projects_Update.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/Projects_Update.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/StorageMovers_CreateOrUpdate.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/StorageMovers_CreateOrUpdate.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/StorageMovers_CreateOrUpdate.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/StorageMovers_CreateOrUpdate.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/StorageMovers_Delete.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/StorageMovers_Delete.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/StorageMovers_Delete.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/StorageMovers_Delete.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/StorageMovers_Get.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/StorageMovers_Get.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/StorageMovers_Get.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/StorageMovers_Get.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/StorageMovers_List.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/StorageMovers_List.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/StorageMovers_List.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/StorageMovers_List.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/StorageMovers_ListBySubscription.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/StorageMovers_ListBySubscription.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/StorageMovers_ListBySubscription.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/StorageMovers_ListBySubscription.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/StorageMovers_Update.json b/tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/StorageMovers_Update.json similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/examples/2025-07-01/StorageMovers_Update.json rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/examples/2025-07-01/StorageMovers_Update.json diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/main.tsp b/tests-upgrade/tests-emitter/StorageMover.Management.brown/main.tsp similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/main.tsp rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/main.tsp diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/models.tsp b/tests-upgrade/tests-emitter/StorageMover.Management.brown/models.tsp similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/models.tsp rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/models.tsp diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/.gitattributes b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/.gitattributes new file mode 100644 index 00000000000..2125666142e --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/Az.StorageMover.csproj b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/Az.StorageMover.csproj similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/Az.StorageMover.csproj rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/Az.StorageMover.csproj diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/Az.StorageMover.nuspec b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/Az.StorageMover.nuspec similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/Az.StorageMover.nuspec rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/Az.StorageMover.nuspec diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/Az.StorageMover.psm1 b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/Az.StorageMover.psm1 similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/Az.StorageMover.psm1 rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/Az.StorageMover.psm1 diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/MSSharedLibKey.snk b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/MSSharedLibKey.snk new file mode 100644 index 0000000000000000000000000000000000000000..695f1b38774e839e5b90059bfb7f32df1dff4223 GIT binary patch literal 160 zcmV;R0AK$ABme*efB*oL000060ssI2Bme+XQ$aBR1ONa50098C{E+7Ye`kjtcRG*W zi8#m|)B?I?xgZ^2Sw5D;l4TxtPwG;3)3^j?qDHjEteSTF{rM+4WI`v zCD?tsZ^;k+S&r1&HRMb=j738S=;J$tCKNrc$@P|lZ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The remote server returned an error: (401) Unauthorized. + + + Account "{0}" has been added. + + + To switch to a different subscription, please use Select-AzureSubscription. + + + Subscription "{0}" is selected as the default subscription. + + + To view all the subscriptions, please use Get-AzureSubscription. + + + Add-On {0} is created successfully. + + + Add-on name {0} is already used. + + + Add-On {0} not found. + + + Add-on {0} is removed successfully. + + + Add-On {0} is updated successfully. + + + Role has been created at {0}\{1}. + + + Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for Node.js by running ‘npm install azure’. + + + Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for PHP by running "pear WindowsAzure/WindowsAzure". + + + Unable to set role permissions. Please give the 'Network Service' user 'Read & execute' and 'Modify' permissions to the role folder, or run PowerShell as an Administrator + + + A role name '{0}' already exists + + + Windows Azure Powershell\ + + + https://manage.windowsazure.com + + + AZURE_PORTAL_URL + + + Azure SDK\{0}\ + + + Base Uri was empty. + WAPackIaaS + + + {0} begin processing without ParameterSet. + + + {0} begin processing with ParameterSet '{1}'. + + + Blob with the name {0} already exists in the account. + + + https://{0}.blob.core.windows.net/ + + + AZURE_BLOBSTORAGE_TEMPLATE + + + CACHERUNTIMEURL + + + cache + + + CacheRuntimeVersion + + + Installing caching version {0} for Role '{1}' (the caching version locally installed is: {2}) + + + Cannot find {0} with name {1}. + + + Deployment for service {0} with {1} slot doesn't exist + + + Can't find valid Microsoft Azure role in current directory {0} + + + service {0} configuration file (ServiceConfiguration.Cloud.cscfg) is either null or doesn't exist + + + Invalid service path! Cannot locate ServiceDefinition.csdef in current folder or parent folders. + + + The subscription named {0} with id {1} is not currently imported. You must import this subscription before it can be updated. + + + ManagementCertificate + + + certificate.pfx + + + Certificate imported into CurrentUser\My\{0} + + + Your account does not have access to the private key for certificate {0} + + + {0} {1} deployment for {2} service + + + Cloud service {0} is in {1} state. + + + Changing/Removing public environment '{0}' is not allowed. + + + Service {0} is set to value {1} + + + Choose which publish settings file to use: + + + Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel + + + 1 + + + cloud_package.cspkg + + + ServiceConfiguration.Cloud.cscfg + + + Add-ons for {0} + + + Communication could not be established. This could be due to an invalid subscription ID. Note that subscription IDs are case sensitive. + + + Complete + + + config.json + + + VirtualMachine creation failed. + WAPackIaaS + + + Creating the website failed. If this is the first website for this subscription, please create it using the management portal instead. + + + Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core + + + //blobcontainer[@datacenter='{0}'] + + + Setting: {0} as the default and current subscription. To view other subscriptions use Get-AzureSubscription + + + none + + + There are no hostnames which could be used for validation. + + + 8080 + + + 1000 + + + Auto + + + 80 + + + Delete + WAPackIaaS + + + The {0} slot for service {1} is already in {2} state + + + The deployment in {0} slot for service {1} is removed + + + Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel + + + 1 + + + The key to add already exists in the dictionary. + + + The array index cannot be less than zero. + + + The supplied array does not have enough room to contain the copied elements. + + + The provided dns {0} doesn't exist + + + Microsoft Azure Certificate + + + Endpoint can't be retrieved for storage account + + + {0} end processing. + + + To use Active Directory authentication, you must configure the ActiveDirectoryEndpoint, ActiveDirectoryTenantId, and ActiveDirectorServiceEndpointResourceId for environment of '{0}'. You can configure these properties for this environment using the Set-AzureEnvironment cmdlet. + + + The environment '{0}' already exists. + + + environments.xml + + + Error creating VirtualMachine + WAPackIaaS + + + Unable to download available runtimes for location '{0}' + + + Error updating VirtualMachine + WAPackIaaS + + + Job Id {0} failed. Error: {1}, ExceptionDetails: {2} + WAPackIaaS + + + The HTTP request was forbidden with client authentication scheme 'Anonymous'. + + + This add-on requires you to purchase the first instance through the Microsoft Azure Portal. Subsequent purchases can be performed through PowerShell. + + + Operation Status: + + + Resources\Scaffolding\General + + + Getting all available Microsoft Azure Add-Ons, this may take few minutes... + + + Name{0}Primary Key{0}Seconday Key + + + Git not found. Please install git and place it in your command line path. + + + Could not find publish settings. Please run Import-AzurePublishSettingsFile. + + + iisnode.dll + + + iisnode + + + iisnode-dev\\release\\x64 + + + iisnode + + + Installing IISNode version {0} in Azure for WebRole '{1}' (the version locally installed is: {2}) + + + Internal Server Error + + + Cannot enable memcach protocol on a cache worker role {0}. + + + Invalid certificate format. + + + The provided configuration path is invalid or doesn't exist + + + The country name is invalid, please use a valid two character country code, as described in ISO 3166-1 alpha-2. + + + Deployment with {0} does not exist + + + The deployment slot name {0} is invalid. Slot name must be either "Staging" or "Production". + + + Invalid service endpoint. + + + File {0} has invalid characters + + + You must create your git publishing credentials using the Microsoft Azure portal. +Please follow these steps in the portal: +1. On the left side open "Web Sites" +2. Click on any website +3. Choose "Setup Git Publishing" or "Reset deployment credentials" +4. Back in the PowerShell window, rerun this command by typing "New-AzureWebSite {site name} -Git -PublishingUsername {username} + + + The value {0} provided is not a valid GUID. Please provide a valid GUID. + + + The specified hostname does not exist. Please specify a valid hostname for the site. + + + Role {0} instances must be greater than or equal 0 and less than or equal 20 + + + There was an error creating your webjob. Please make sure that the script is in the root folder of the zip file. + + + Could not download a valid runtime manifest, Please check your internet connection and try again. + + + The account {0} was not found. Please specify a valid account name. + + + The provided name "{0}" does not match the service bus namespace naming rules. + + + Value cannot be null. Parameter name: '{0}' + + + The provided package path is invalid or doesn't exist + + + '{0}' is an invalid parameter set name. + + + {0} doesn't exist in {1} or you've not passed valid value for it + + + Path {0} has invalid characters + + + The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile + + + The provided role name "{0}" has invalid characters + + + A valid name for the service root folder is required + + + {0} is not a recognized runtime type + + + A valid language is required + + + No subscription is currently selected. Use Select-Subscription to activate a subscription. + + + The provided location "{0}" does not exist in the available locations use Get-AzureSBLocation for listing available locations. + + + Please provide a service name or run this command from inside a service project directory. + + + You must provide valid value for {0} + + + settings.json is invalid or doesn't exist + + + The subscription named '{0}' cannot be found. Use Set-AzureSubscription to initialize the subscription data. + + + The provided subscription id {0} is not valid + + + A valid subscription name is required. This can be provided using the -Subscription parameter or by setting the subscription via the Set-AzureSubscription cmdlet + + + The provided subscriptions file {0} has invalid content. + + + Role {0} VM size should be ExtraSmall, Small, Medium, Large or ExtraLarge. + + + The web job file must have *.zip extension + + + Singleton option works for continuous jobs only. + + + The website {0} was not found. Please specify a valid website name. + + + No job for id: {0} was found. + WAPackIaaS + + + engines + + + Scaffolding for this language is not yet supported + + + Link already established + + + local_package.csx + + + ServiceConfiguration.Local.cscfg + + + Looking for {0} deployment for {1} cloud service... + + + Looking for cloud service {0}... + + + managementCertificate.pem + + + ?whr={0} + + + //baseuri + + + uri + + + http://az413943.vo.msecnd.net/node/runtimemanifest_0.7.5.2.xml + + + Multiple Add-Ons found holding name {0} + + + Multiple possible publishing users. Please go to the Portal and use the listed deployment user, or click 'set/reset deployment credentials' to set up a new user account, then reurn this cmdlet and specify PublishingUsername. + + + The first publish settings file "{0}" is used. If you want to use another file specify the file name. + + + Microsoft.WindowsAzure.Plugins.Caching.NamedCaches + + + {"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":1},"serverNotification":{"isEnabled":false}},"secondaries":0}]} + + + A publishing username is required. Please specify one using the argument PublishingUsername. + + + New Add-On Confirmation + + + By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my +contact information with {2}. + + + Internal Server Error. This could happen because the namespace name is already used or due to an incorrect location name. Use Get-AzureSBLocation cmdlet to list valid names. + + + By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of +use and privacy statement at {0} and (c) agree to sharing my contact information with {2}. + + + Service has been created at {0} + + + No + + + There is no access token cached for subscription {0}, user id {1}. Use the Add-AzureAccount cmdlet to log in again and get a token for this subscription. + + + The service does not have any cache worker roles, add one first by running cmdlet Add-AzureCacheWorkerRole. + + + No clouds available + WAPackIaaS + + + nodejs + + + node + + + node.exe + + + There is no default subscription set, please set a default subscription by running Set-AzureSubscription -Default <subscription name> + + + Microsoft SDKs\Azure\Nodejs\Nov2011 + + + nodejs + + + node + + + Resources\Scaffolding\Node + + + Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.Node + + + Installing Node version {0} in Azure for Role '{1}' (the Node version locally installed is: {2}) + + + No, I do not agree + + + No publish settings files with extension *.publishsettings are found in the directory "{0}". + + + '{0}' must be a cache worker role. Verify that it has proper cache worker role configuration. + + + Certificate can't be null. + + + {0} could not be null or empty + + + Unable to add a null RoleSettings to {0} + + + Unable to add new role to null service definition + + + The request offer '{0}' is not found. + + + Operation "{0}" failed on VM with ID: {1} + WAPackIaaS + + + The REST operation failed with message '{0}' and error code '{1}' + + + Job Id {0} did not complete within expected time or it is in Failed/Canceled/Invalid state. + WAPackIaaS + + + package + + + Package is created at service root path {0}. + + + {{ + "author": "", + + "name": "{0}", + "version": "0.0.0", + "dependencies":{{}}, + "devDependencies":{{}}, + "optionalDependencies": {{}}, + "engines": {{ + "node": "*", + "iisnode": "*" + }} + +}} + + + + package.json + + + A value for the Peer Asn has to be provided. + + + 5.4.0 + + + php + + + Resources\Scaffolding\PHP + + + Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.PHP + + + Installing PHP version {0} for Role '{1}' (the PHP version locally installed is: {2}) + + + You must create your first web site using the Microsoft Azure portal. +Please follow these steps in the portal: +1. At the bottom of the page, click on New > Web Site > Quick Create +2. Type {0} in the URL field +3. Click on "Create Web Site" +4. Once the site has been created, click on the site name +5. Click on "Set up Git publishing" or "Reset deployment credentials" and setup a publishing username and password. Use those credentials for all new websites you create. + + + 6. Back in the console window, rerun this command by typing "New-AzureWebsite <site name> -Git" + + + A value for the Primary Peer Subnet has to be provided. + + + Promotion code can be used only when updating to a new plan. + + + Service not published at user request. + + + Complete. + + + Connecting... + + + Created Deployment ID: {0}. + + + Created hosted service '{0}'. + + + Created Website URL: {0}. + + + Creating... + + + Initializing... + + + busy + + + creating the virtual machine + + + Instance {0} of role {1} is {2}. + + + ready + + + Preparing deployment for {0} with Subscription ID: {1}... + + + Publishing {0} to Microsoft Azure. This may take several minutes... + + + publish settings + + + Azure + + + .PublishSettings + + + publishSettings.xml + + + Publish settings imported + + + AZURE_PUBLISHINGPROFILE_URL + + + Starting... + + + Upgrading... + + + Uploading Package to storage service {0}... + + + Verifying storage account '{0}'... + + + Replace current deployment with '{0}' Id ? + + + Are you sure you want to regenerate key? + + + Generate new key. + + + Are you sure you want to remove account '{0}'? + + + Removing account + + + Remove Add-On Confirmation + + + If you delete this add-on, your data may be deleted and the operation may not be undone. You may have to purchase it again from the Microsoft Azure Store to use it. The price of the add-on may not be refunded. Are you sure you want to delete this add-on? Enter “Yes” to confirm. + + + Remove-AzureBGPPeering Operation failed. + + + Removing Bgp Peering + + + Successfully removed Azure Bgp Peering with Service Key {0}. + + + Are you sure you want to remove the Bgp Peering with service key '{0}'? + + + Are you sure you want to remove the Dedicated Circuit with service key '{0}'? + + + Remove-AzureDedicatedCircuit Operation failed. + + + Remove-AzureDedicatedCircuitLink Operation failed. + + + Removing Dedicated Circui Link + + + Successfully removed Azure Dedicated Circuit Link with Service Key {0} and Vnet Name {1} + + + Are you sure you want to remove the Dedicated Circuit Link with service key '{0}' and virtual network name '{1}'? + + + Removing Dedicated Circuit + + + Successfully removed Azure Dedicated Circuit with Service Key {0}. + + + Removing cloud service {0}... + + + Removing {0} deployment for {1} service + + + Removing job collection + + + Are you sure you want to remove the job collection "{0}" + + + Removing job + + + Are you sure you want to remove the job "{0}" + + + Are you sure you want to remove the account? + + + Account removed. + + + Internal Server Error. This could happen because the namespace does not exist or it does not exist under your subscription. + + + Removing old package {0}... + + + Are you sure you want to delete the namespace '{0}'? + + + Are you sure you want to remove cloud service? + + + Remove cloud service and all it's deployments + + + Are you sure you want to remove subscription '{0}'? + + + Removing subscription + + + Are you sure you want to delete the VM '{0}'? + + + Deleting VM. + + + Removing WebJob... + + + Are you sure you want to remove job '{0}'? + + + Removing website + + + Are you sure you want to remove the website "{0}" + + + Deleting namespace + + + Repository is not setup. You need to pass a valid site name. + + + Reserved IP with the Name:'{0}' will no longer be in use after the deployment is deleted, and it is still reserved for later use. + + + Resource with ID : {0} does not exist. + WAPackIaaS + + + Restart + WAPackIaaS + + + Resume + WAPackIaaS + + + /role:{0};"{1}/{0}" + + + bin + + + Role {0} is {1} + + + 20 + + + role name + + + The provided role name {0} doesn't exist + + + RoleSettings.xml + + + Role type {0} doesn't exist + + + public static Dictionary<string, Location> ReverseLocations { get; private set; } + + + Preparing runtime deployment for service '{0}' + + + WARNING Runtime Mismatch: Are you sure that you want to publish service '{0}' using an Azure runtime version that does not match your local runtime version? + + + RUNTIMEOVERRIDEURL + + + /runtimemanifest/runtimes/runtime + + + RUNTIMEID + + + RUNTIMEURL + + + RUNTIMEVERSIONPRIMARYKEY + + + scaffold.xml + + + Invalid location entered. Pick one of the locations from Get-AzureSchedulerLocation + + + A value for the Secondary Peer Subnet has to be provided. + + + Service {0} already exists on disk in location {1} + + + No ServiceBus authorization rule with the given characteristics was found + + + The service bus entity '{0}' is not found. + + + Internal Server Error. This could happen due to an incorrect/missing namespace + + + service configuration + + + service definition + + + ServiceDefinition.csdef + + + {0}Deploy + + + The specified cloud service "{0}" does not exist. + + + {0} slot for service {1} is in {2} state, please wait until it finish and update it's status + + + Begin Operation: {0} + + + Completed Operation: {0} + + + Begin Operation: {0} + + + Completed Operation: {0} + + + service name + + + Please provide name for the hosted service + + + service parent directory + + + Service {0} removed successfully + + + service directory + + + service settings + + + The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + + + The {0} slot for cloud service {1} doesn't exist. + + + {0} slot for service {1} is {2} + + + Set Add-On Confirmation + + + Note - You will be charged the amount for the new plan, without being refunded for time remaining +in the existing plan. +By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my +contact information with {2}. + + + Note - You will be charged the amount for the new plan, without being refunded for time remaining +in the existing plan. +By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of +use and privacy statement at <url> and (c) agree to sharing my contact information with {2}. + + + Role {0} instances are set to {1} + + + {"Slot":"","Location":"","Subscription":"","StorageAccountName":""} + + + deploymentSettings.json + + + Confirm + + + Shutdown + WAPackIaaS + + + /sites:{0};{1};"{2}/{0}" + + + 1000 + + + Start + WAPackIaaS + + + Started + + + Starting Emulator... + + + start + + + Stop + WAPackIaaS + + + Stopping emulator... + + + Stopped + + + stop + + + Account Name: + + + Cannot find storage account '{0}' please type the name of an existing storage account. + + + AzureStorageEmulator.exe + + + InstallPath + + + SOFTWARE\Microsoft\Windows Azure Storage Emulator + + + Primary Key: + + + Secondary Key: + + + The subscription named {0} already exists. + + + DefaultSubscriptionData.xml + + + The subscription data file {0} does not exist. + + + Subscription must not be null + WAPackIaaS + + + Suspend + WAPackIaaS + + + Swapping website production slot ... + + + Are you sure you want to swap the website '{0}' production slot with slot '{1}'? + + + The provider {0} is unknown. + + + Update + WAPackIaaS + + + Updated settings for subscription '{0}'. Current subscription is '{1}'. + + + A value for the VLan Id has to be provided. + + + Please wait... + + + The azure storage emulator is not installed, skip launching... + + + Web.cloud.config + + + web.config + + + MSDeploy + + + Cannot build the project successfully. Please see logs in {0}. + + + WebRole + + + setup_web.cmd > log.txt + + + WebRole.xml + + + WebSite with given name {0} already exists in the specified Subscription and Webspace. + + + WebSite with given name {0} already exists in the specified Subscription and Location. + + + Site {0} already has repository created for it. + + + Workspaces/WebsiteExtension/Website/{0}/dashboard/ + + + https://{0}/msdeploy.axd?site={1} + + + WorkerRole + + + setup_worker.cmd > log.txt + + + WorkerRole.xml + + + Yes + + + Yes, I agree + + + Remove-AzureTrafficManagerProfile Operation failed. + + + Successfully removed Traffic Manager profile with name {0}. + + + Are you sure you want to remove the Traffic Manager profile "{0}"? + + + Profile {0} already has an endpoint with name {1} + + + Profile {0} does not contain endpoint {1}. Adding it. + + + The endpoint {0} cannot be removed from profile {1} because it's not in the profile. + + + Insufficient parameters passed to create a new endpoint. + + + Ambiguous operation: the profile name specified doesn't match the name of the profile object. + + + <NONE> + + + "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}." + {0} is the HTTP status code. {1} is the Service Management Error Code. {2} is the Service Management Error message. {3} is the operation tracking ID. + + + Unable to decode string from base 64. Please make sure the string is correctly encoded: {0}. + {0} is the string that is not in a valid base 64 format. + + + Skipping external tenant {0}, because you are using a guest or a foreign principal object identity. In order to access this tenant, please run Add-AzureAccount without "-Credential". + + + Removing an environment will remove all associated subscriptions and accounts. Are you sure you want to remove an environment '{0}'? + + + Removing environment + + + There is no subscription associated with account {0}. + + + Account id doesn't match one in subscription. + + + Environment name doesn't match one in subscription. + + + Removing the Azure profile will remove all associated environments, subscriptions, and accounts. Are you sure you want to remove the Azure profile? + + + Removing the Azure profile + + + The SubscriptionDataFile parameter is deprecated. This parameter will be removed in a future release. See https://github.com/Azure/azure-powershell/wiki/Proposed-Design-Stateless-Azure-Profile for a description of the upcoming mechanism for providing alternate sources of subscription information. + + + Account needs to be specified + + + No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription. + + + Path must specify a valid path to an Azure profile. + + + Property bag Hashtable must contain one of the following sets of properties: {SubscriptionId, Certificate}, {SubscriptionId, Username, Password}, {SubscriptionId, ServicePrincipal, Password, Tenant}, {SubscriptionId, AccountId, Token} + + + Property bag Hashtable must contain a 'Certificate' of type 'X509Certificate2'. + + + Property bag Hashtable must contain a 'Password' with an associated 'Username' or 'ServicePrincipal'. + + + Property bag Hashtable must contain a 'SubscriptionId'. + + + Selected profile must not be null. + + + The Switch-AzureMode cmdlet is deprecated and will be removed in a future release. + + + OperationID : '{0}' + + + Cannot get module for DscResource '{0}'. Possible solutions: +1) Specify -ModuleName for Import-DscResource in your configuration. +2) Unblock module that contains resource. +3) Move Import-DscResource inside Node block. + + 0 = name of DscResource + + + Your current PowerShell version {1} is less then required by this cmdlet {0}. Consider download and install latest PowerShell version. + {0} = minimal required PS version, {1} = current PS version + + + Parsing configuration script: {0} + {0} is the path to a script file + + + Configuration script '{0}' contained parse errors: +{1} + 0 = path to the configuration script, 1 = parser errors + + + List of required modules: [{0}]. + {0} = list of modules + + + Temp folder '{0}' created. + {0} = temp folder path + + + Copy '{0}' to '{1}'. + {0} = source, {1} = destination + + + Copy the module '{0}' to '{1}'. + {0} = source, {1} = destination + + + File '{0}' already exists. Use the -Force parameter to overwrite it. + {0} is the path to a file + + + Configuration file '{0}' not found. + 0 = path to the configuration file + + + Path '{0}' not found. + 0 = path to the additional content file/directory + + + Path '{0}' not found. + 0 = path to the additional content file/directory + + + Invalid configuration file: {0}. +The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip). + 0 = path to the configuration file + + + Invalid configuration file: {0}. +The file needs to be a PowerShell script (.ps1 or .psm1). + 0 = path to the configuration file + + + Create Archive + + + Upload '{0}' + {0} is the name of an storage blob + + + Storage Blob '{0}' already exists. Use the -Force parameter to overwrite it. + {0} is the name of an storage blob + + + Configuration published to {0} + {0} is an URI + + + Deleted '{0}' + {0} is the path of a file + + + Cannot delete '{0}': {1} + {0} is the path of a file, {1} is an error message + + + Cannot find the WadCfg end element in the config. + + + WadCfg start element in the config is not matching the end element. + + + Cannot find the WadCfg element in the config. + + + Cannot find configuration data file: {0} + + + The configuration data must be a .psd1 file + + + Cannot change built-in environment {0}. + + + Azure PowerShell collects usage data in order to improve your experience. +The data is anonymous and does not include commandline argument values. +The data is collected by Microsoft. + +Use the Disable-AzDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Az.Accounts module. To disable data collection: PS > Disable-AzDataCollection. +Use the Enable-AzDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Az.Accounts module. To enable data collection: PS > Enable-AzDataCollection. + + + Microsoft Azure PowerShell Data Collection Confirmation + + + You choose not to participate in Microsoft Azure PowerShell data collection. + + + This confirmation message will be dismissed in '{0}' second(s)... + + + You choose to participate in Microsoft Azure PowerShell data collection. + + + The setting profile has been saved to the following path '{0}'. + + + [Common.Authentication]: Authenticating for account {0} with single tenant {1}. + + + Changing public environment is not supported. + + + Environment name needs to be specified. + + + Environment needs to be specified. + + + The environment name '{0}' is not found. + + + File path is not valid. + + + Must specify a non-null subscription name. + + + The default subscription is being removed. Use Select-AzureSubscription -Default <subscriptionName> to select a new default subscription. + + + Removing public environment is not supported. + + + The subscription id {0} doesn't exist. + + + Subscription name needs to be specified. + + + The subscription name {0} doesn't exist. + + + Subscription needs to be specified. + + + User name is not valid. + + + User name needs to be specified. + + + "There is no current context, please log in using Connect-AzAccount." + + + No subscriptions are associated with the logged in account in Azure Service Management (RDFE). This means that the logged in user is not an administrator or co-administrator for any account.\r\nDid you mean to execute Connect-AzAccount? + + + No certificate was found in the certificate store with thumbprint {0} + + + Illegal characters in path. + + + Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings + + + "{0}" is an invalid DNS name for {1} + + + The provided file in {0} must be have {1} extension + + + {0} is invalid or empty + + + Please connect to internet before executing this cmdlet + + + Path {0} doesn't exist. + + + Path for {0} doesn't exist in {1}. + + + &whr={0} + + + The provided service name {0} already exists, please pick another name + + + Unable to update mismatching Json structured: {0} {1}. + + + (x86) + + + Azure PowerShell collects usage data in order to improve your experience. +The data is anonymous and does not include commandline argument values. +The data is collected by Microsoft. + +Use the Disable-AzureDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Azure module. To disable data collection: PS > Disable-AzureDataCollection. +Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Azure module. To enable data collection: PS > Enable-AzureDataCollection. + + + Execution failed because a background thread could not prompt the user. + + + Azure Long-Running Job + + + The cmdlet failed in background execution. The returned error was '{0}'. Please execute the cmdlet again. You may need to execute this cmdlet synchronously, by omitting the '-AsJob' parameter. + 0(string): exception message in background task + + + Please execute the cmdlet again and include the 'Force' parameter, if available, to avoid unnecessary prompts. + + + Please execute the cmdlet again and omit the 'Confirm' parameter when using the 'AsJob' parameter. + + + Please increase the user $ConfirmPreference setting, or include turn off confirmation using '-Confirm:$false' when using the 'AsJob' parameter and execute the cmdet again. + + + Please execute the cmdlet again and omit the 'WhatIf' parameter when using the 'AsJob' parameter. + + + [AzureLongRunningJob]: Starting cmdlet execution, setting for cmdlet confirmation required: '{0}' + 0(bool): whether cmdlet confirmation is required + + + [AzureLongRunningJob]: Blocking job for ShouldMethod '{0}' + 0(string): method type + + + [AzureLongRunningJob]: Completing cmdlet execution in RunJob + + + [AzureLongRunningJob]: State change from '{0}' to '{1}' because '{2}' + 0(string): last state, 1(string): new state, 2(string): state change reason + + + [AzureLongRunningJob]: Unblocking job due to stoppage or failure + + + [AzureLongRunningJob]: Unblocking job that was previously blocked. + + + [AzureLongRunningJob]: Error in cmdlet execution + + + [AzureLongRunningJob]: Removing state changed event handler, exception '{0}' + 0(string): exception message + + + [AzureLongRunningJob]: ShouldMethod '{0}' unblocked. + 0(string): methodType + + + +- The parameter : '{0}' is changing. + + + +- The parameter : '{0}' is becoming mandatory. + + + +- The parameter : '{0}' is being replaced by parameter : '{1}'. + + + +- The parameter : '{0}' is being replaced by mandatory parameter : '{1}'. + + + +- Change description : {0} + + + The cmdlet is being deprecated. There will be no replacement for it. + + + The cmdlet parameter set is being deprecated. There will be no replacement for it. + + + The cmdlet '{0}' is replacing this cmdlet. + + + +- The output type is changing from the existing type :'{0}' to the new type :'{1}' + + + +- The output type '{0}' is changing + + + +- The following properties are being added to the output type : + + + +- The following properties in the output type are being deprecated : + + + {0} + + + +- Cmdlet : '{0}' + - {1} + + + Upcoming breaking changes in the cmdlet '{0}' : + + + +- This change will take effect on '{0}' + + + +- The change is expected to take effect in '{0}' from version : '{1}' + + + ```powershell +# Old +{0} + +# New +{1} +``` + + + + +Cmdlet invocation changes : + Old Way : {0} + New Way : {1} + + + +The output type '{0}' is being deprecated without a replacement. + + + +The type of the parameter is changing from '{0}' to '{1}'. + + + +Note : Go to {0} for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell. + + + This cmdlet is in preview. Its behavior is subject to change based on customer feedback. + + + The estimated generally available date is '{0}'. + + + - The change is expected to take effect from Az version : '{0}' + + \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/Response.cs b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/Response.cs similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/Response.cs rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/Response.cs diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/Serialization/JsonSerializer.cs b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/Serialization/JsonSerializer.cs similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/Serialization/JsonSerializer.cs rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/Serialization/JsonSerializer.cs diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/Serialization/PropertyTransformation.cs b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/Serialization/PropertyTransformation.cs similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/Serialization/PropertyTransformation.cs rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/Serialization/PropertyTransformation.cs diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/Serialization/SerializationOptions.cs b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/Serialization/SerializationOptions.cs similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/Serialization/SerializationOptions.cs rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/Serialization/SerializationOptions.cs diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/SerializationMode.cs b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/SerializationMode.cs similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/SerializationMode.cs rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/SerializationMode.cs diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/TypeConverterExtensions.cs b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/TypeConverterExtensions.cs similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/TypeConverterExtensions.cs rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/TypeConverterExtensions.cs diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/UndeclaredResponseException.cs b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/UndeclaredResponseException.cs similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/UndeclaredResponseException.cs rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/UndeclaredResponseException.cs diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/Writers/JsonWriter.cs b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/Writers/JsonWriter.cs similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/Writers/JsonWriter.cs rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/Writers/JsonWriter.cs diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/delegates.cs b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/delegates.cs similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/generated/runtime/delegates.cs rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/generated/runtime/delegates.cs diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/how-to.md b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/how-to.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/how-to.md rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/how-to.md diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/internal/Az.StorageMover.internal.psm1 b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/internal/Az.StorageMover.internal.psm1 similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/internal/Az.StorageMover.internal.psm1 rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/internal/Az.StorageMover.internal.psm1 diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/internal/README.md b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/internal/README.md similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/internal/README.md rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/internal/README.md diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/license.txt b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/license.txt new file mode 100644 index 00000000000..b9f3180fb9a --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/license.txt @@ -0,0 +1,227 @@ +MICROSOFT SOFTWARE LICENSE TERMS + +MICROSOFT AZURE POWERSHELL + +These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. + +BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE. + + +-----------------START OF LICENSE-------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +-------------------END OF LICENSE------------------------------------------ + + +----------------START OF THIRD PARTY NOTICE-------------------------------- + + +The software includes the AutoMapper library ("AutoMapper"). The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software. + +Provided for Informational Purposes Only + +AutoMapper + +The MIT License (MIT) +Copyright (c) 2010 Jimmy Bogard + + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + + + +*************** + +The software includes Newtonsoft.Json. The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software. + +Newtonsoft.Json + +The MIT License (MIT) +Copyright (c) 2007 James Newton-King +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +-------------END OF THIRD PARTY NOTICE---------------------------------------- + diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/pack-module.ps1 b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/pack-module.ps1 new file mode 100644 index 00000000000..2f30ca3fffa --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/pack-module.ps1 @@ -0,0 +1,17 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +Write-Host -ForegroundColor Green 'Packing module...' +dotnet pack $PSScriptRoot --no-build /nologo +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/resources/README.md b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/resources/README.md new file mode 100644 index 00000000000..937f07f8fec --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/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/tests-upgrade/tests-emitter/StorageMover.Management/target/run-module.ps1 b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/run-module.ps1 similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/run-module.ps1 rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/run-module.ps1 diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/test-module.ps1 b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/test-module.ps1 similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/target/test-module.ps1 rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/target/test-module.ps1 diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/test/README.md b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/test/README.md new file mode 100644 index 00000000000..7c752b4c8c4 --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/test/README.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `..\custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/test/loadEnv.ps1 b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/test/loadEnv.ps1 new file mode 100644 index 00000000000..6a7c385c6b7 --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/test/loadEnv.ps1 @@ -0,0 +1,29 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +$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 + $PSDefaultParameterValues=@{"*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/.gitattributes b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/.gitattributes new file mode 100644 index 00000000000..2125666142e --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/README.md b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/README.md new file mode 100644 index 00000000000..d28996846ef --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/README.md @@ -0,0 +1,438 @@ + +# Az.Resources.TestSupport +This directory contains the PowerShell module for the Resources service. + +--- +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.Resources.TestSupport`, see [how-to.md](how-to.md). + + +--- +## Generation Requirements +Use of the beta version of `autorest.powershell` generator requires the following: +- [NodeJS LTS](https://nodejs.org) (10.15.x LTS preferred) + - **Note**: It *will not work* with Node < 10.x. Using 11.x builds may cause issues as they may introduce instability or breaking changes. +> If you want an easy way to install and update Node, [NVS - Node Version Switcher](../nodejs/installing-via-nvs.md) or [NVM - Node Version Manager](../nodejs/installing-via-nvm.md) is recommended. +- [AutoRest](https://aka.ms/autorest) v3
`npm install -g autorest`
  +- PowerShell 6.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g pwsh`
  +- .NET Core SDK 2.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g dotnet-sdk-2.2`
  + +## Run Generation +In this directory, run AutoRest: +> `autorest` + +--- +### AutoRest Configuration +> see https://aka.ms/autorest + +> Values +``` yaml +azure: true +powershell: true +branch: master +repo: https://github.com/Azure/azure-rest-api-specs/blob/$(branch) +metadata: + authors: Microsoft Corporation + owners: Microsoft Corporation + copyright: Microsoft Corporation. All rights reserved. + companyName: Microsoft Corporation + requireLicenseAcceptance: true + licenseUri: https://aka.ms/azps-license + projectUri: https://github.com/Azure/azure-powershell +``` + +> Names +``` yaml +prefix: Az +``` + +> Folders +``` yaml +clear-output-folder: true +``` + +``` yaml +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/d55f30f41f04e712de101fc9c17a591ca410bfed/specification/resources/resource-manager/Microsoft.Resources/stable/2018-05-01/resources.json +module-name: Az.Resources.TestSupport +namespace: Microsoft.Azure.PowerShell.Cmdlets.Resources + +subject-prefix: '' +module-version: 0.0.1 +title: Resources + +directive: + - remove-operation: Deployments_CreateOrUpdateAtSubscriptionScope + - where: + subject: Operation + hide: true + - where: + parameter-name: SubscriptionId + set: + default: + script: '(Get-AzContext).Subscription.Id' + - from: swagger-document + where: $..parameters[?(@.name=='$filter')] + transform: $['x-ms-skip-url-encoding'] = true + - from: swagger-document + where: $..[?( /Resources_(CreateOrUpdate|Update|Delete|Get|GetById|CheckExistence|CheckExistenceById)/g.exec(@.operationId))] + transform: "$.parameters = $.parameters.map( each => { each.name = each.name === 'api-version' ? 'explicit-api-version' : each.name; return each; } );" + - from: source-file-csharp + where: $ + transform: $ = $.replace(/explicit-api-version/g, 'api-version'); + - where: + parameter-name: ExplicitApiVersion + set: + parameter-name: ApiVersion + - from: source-file-csharp + where: $ + transform: > + $ = $.replace(/result.OdataNextLink/g,'nextLink' ); + return $.replace( /(^\s*)(if\s*\(\s*nextLink\s*!=\s*null\s*\))/gm, '$1var nextLink = Module.Instance.FixNextLink(responseMessage, result.OdataNextLink);\n$1$2' ); + - from: swagger-document + where: + - $..DeploymentProperties.properties.template + - $..DeploymentProperties.properties.parameters + - $..ResourceGroupExportResult.properties.template + - $..PolicyDefinitionProperties.properties.policyRule + transform: $.additionalProperties = true; + - where: + verb: Set + subject: Resource + remove: true + - where: + verb: Set + subject: Deployment + remove: true + - where: + subject: Resource + parameter-name: GroupName + set: + parameter-name: ResourceGroupName + clear-alias: true + - where: + subject: Resource + parameter-name: Id + set: + parameter-name: ResourceId + clear-alias: true + - where: + subject: Resource + parameter-name: Type + set: + parameter-name: ResourceType + clear-alias: true + - where: + subject: Appliance* + remove: true + - where: + verb: Test + subject: CheckNameAvailability + set: + subject: NameAvailability + - where: + verb: Export + subject: ResourceGroupTemplate + set: + subject: ResourceGroup + alias: Export-AzResourceGroupTemplate + - where: + parameter-name: Filter + set: + alias: ODataQuery + - where: + verb: Test + subject: ResourceGroupExistence + set: + subject: ResourceGroup + alias: Test-AzResourceGroupExistence + - where: + verb: Export + subject: DeploymentTemplate + set: + alias: [Save-AzDeploymentTemplate, Save-AzResourceGroupDeploymentTemplate] + - where: + subject: Deployment + set: + alias: ${verb}-AzResourceGroupDeployment + - where: + verb: Get + subject: DeploymentOperation + set: + alias: Get-AzResourceGroupDeploymentOperation + - where: + verb: New + subject: Deployment + variant: Create.*Expanded.* + parameter-name: Parameter + set: + parameter-name: DeploymentPropertyParameter + - where: + verb: New + subject: Deployment + hide: true + - where: + verb: Test + subject: Deployment + variant: Validate.*Expanded.* + parameter-name: Parameter + set: + parameter-name: DeploymentPropertyParameter + - where: + verb: New + subject: Deployment + parameter-name: DebugSettingDetailLevel + set: + parameter-name: DeploymentDebugLogLevel + - where: + subject: Provider + set: + subject: ResourceProvider + - where: + subject: ProviderFeature|ResourceProvider|ResourceLock + parameter-name: ResourceProviderNamespace + set: + alias: ProviderNamespace + - where: + verb: Update + subject: ResourceGroup + parameter-name: Name + clear-alias: true + - where: + parameter-name: UpnOrObjectId + set: + alias: ['UserPrincipalName', 'Upn', 'ObjectId'] + - where: + subject: Deployment + variant: (.*)Expanded(.*) + parameter-name: Parameter + set: + parameter-name: DeploymentParameter + # Format output + - where: + model-name: GenericResource + set: + format-table: + properties: + - Name + - ResourceGroupName + - Type + - Location + labels: + Type: ResourceType + - where: + model-name: ResourceGroup + set: + format-table: + properties: + - Name + - Location + - ProvisioningState + - where: + model-name: DeploymentExtended + set: + format-table: + properties: + - Name + - ProvisioningState + - Timestamp + - Mode + - where: + model-name: PolicyAssignment + set: + format-table: + properties: + - Name + - DisplayName + - Id + - where: + model-name: PolicyDefinition + set: + format-table: + properties: + - Name + - DisplayName + - Id + - where: + model-name: PolicySetDefinition + set: + format-table: + properties: + - Name + - DisplayName + - Id + - where: + model-name: Provider + set: + format-table: + properties: + - Namespace + - RegistrationState + - where: + model-name: ProviderResourceType + set: + format-table: + properties: + - ResourceType + - Location + - ApiVersion + - where: + model-name: FeatureResult + set: + format-table: + properties: + - Name + - State + - where: + model-name: TagDetails + set: + format-table: + properties: + - TagName + - CountValue + - where: + model-name: Application + set: + format-table: + properties: + - DisplayName + - ObjectId + - AppId + - Homepage + - AvailableToOtherTenant + - where: + model-name: KeyCredential + set: + format-table: + properties: + - StartDate + - EndDate + - KeyId + - Type + - where: + model-name: PasswordCredential + set: + format-table: + properties: + - StartDate + - EndDate + - KeyId + - where: + model-name: User + set: + format-table: + properties: + - PrincipalName + - DisplayName + - ObjectId + - Type + - where: + model-name: AdGroup + set: + format-table: + properties: + - DisplayName + - Mail + - ObjectId + - SecurityEnabled + - where: + model-name: ServicePrincipal + set: + format-table: + properties: + - DisplayName + - ObjectId + - AppDisplayName + - AppId + - where: + model-name: Location + set: + format-table: + properties: + - Name + - DisplayName + - where: + model-name: ManagementLockObject + set: + format-table: + properties: + - Name + - Level + - ResourceId + - where: + model-name: RoleAssignment + set: + format-table: + properties: + - DisplayName + - ObjectId + - ObjectType + - RoleDefinitionName + - Scope + - where: + model-name: RoleDefinition + set: + format-table: + properties: + - RoleName + - Name + - Action +# To remove cmdlets not used in the test frame + - where: + subject: Operation + remove: true + - where: + subject: Deployment + variant: (.*)1|Cancel(.*)|Validate(.*)|Export(.*)|List(.*)|Delete(.*)|Check(.*)|Calculate(.*) + remove: true + - where: + subject: ResourceProvider + variant: Register(.*)|Unregister(.*)|Get(.*) + remove: true + - where: + subject: ResourceGroup + variant: List(.*)|Update(.*)|Export(.*)|Move(.*) + remove: true + - where: + subject: Resource + remove: true + - where: + subject: Tag|TagValue + remove: true + - where: + subject: DeploymentOperation + remove: true + - where: + subject: DeploymentTemplate + remove: true + - where: + subject: Calculate(.*) + remove: true + - where: + subject: ResourceExistence + remove: true + - where: + subject: ResourceMoveResource + remove: true + - where: + subject: DeploymentExistence + remove: true +``` diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/custom/New-AzDeployment.ps1 b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/custom/New-AzDeployment.ps1 new file mode 100644 index 00000000000..84228dd80a1 --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/custom/New-AzDeployment.ps1 @@ -0,0 +1,231 @@ +function New-AzDeployment { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Resources.Models.IDeploymentExtended')] + [CmdletBinding(DefaultParameterSetName='CreateWithTemplateFileParameterFile', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Description('You can provide the template and parameters directly in the request or link to JSON files.')] + param( + [Parameter(HelpMessage='The name of the deployment. If not provided, the name of the template file will be used. If a template file is not used, a random GUID will be used for the name.')] + [Alias('DeploymentName')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Runtime.Info(SerializedName='deploymentName', Required, PossibleTypes=([System.String]), Description='The name of the deployment.')] + [System.String] + # The name of the deployment. If not provided, the name of the template file will be used. If a template file is not used, a random GUID will be used for the name. + ${Name}, + + [Parameter(Mandatory, HelpMessage='The ID of the target subscription.')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Runtime.Info(SerializedName='subscriptionId', Required, PossibleTypes=([System.String]), Description='The ID of the target subscription.')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CreateRGWithTemplateFileParameterFile', Mandatory, HelpMessage='The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.')] + [Parameter(ParameterSetName='CreateRGWithTemplateFileParameterJson', Mandatory, HelpMessage='The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.')] + [Parameter(ParameterSetName='CreateRGWithTemplateFileParameterObject', Mandatory, HelpMessage='The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.')] + [Parameter(ParameterSetName='CreateRGWithTemplateJsonParameterFile', Mandatory, HelpMessage='The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.')] + [Parameter(ParameterSetName='CreateRGWithTemplateJsonParameterJson', Mandatory, HelpMessage='The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.')] + [Parameter(ParameterSetName='CreateRGWithTemplateJsonParameterObject', Mandatory, HelpMessage='The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.')] + [Parameter(ParameterSetName='CreateRGWithTemplateObjectParameterFile', Mandatory, HelpMessage='The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.')] + [Parameter(ParameterSetName='CreateRGWithTemplateObjectParameterJson', Mandatory, HelpMessage='The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.')] + [Parameter(ParameterSetName='CreateRGWithTemplateObjectParameterObject', Mandatory, HelpMessage='The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Runtime.Info(SerializedName='resourceGroupName', Required, PossibleTypes=([System.String]), Description='The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.')] + [System.String] + # The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='CreateWithTemplateFileParameterFile', Mandatory, HelpMessage='Local path to the JSON template file.')] + [Parameter(ParameterSetName='CreateWithTemplateFileParameterJson', Mandatory, HelpMessage='Local path to the JSON template file.')] + [Parameter(ParameterSetName='CreateWithTemplateFileParameterObject', Mandatory, HelpMessage='Local path to the JSON template file.')] + [Parameter(ParameterSetName='CreateRGWithTemplateFileParameterFile', Mandatory, HelpMessage='Local path to the JSON template file.')] + [Parameter(ParameterSetName='CreateRGWithTemplateFileParameterJson', Mandatory, HelpMessage='Local path to the JSON template file.')] + [Parameter(ParameterSetName='CreateRGWithTemplateFileParameterObject', Mandatory, HelpMessage='Local path to the JSON template file.')] + [System.String] + # Local path to the JSON template file. + ${TemplateFile}, + + [Parameter(ParameterSetName='CreateWithTemplateJsonParameterFile', Mandatory, HelpMessage='The string representation of the JSON template.')] + [Parameter(ParameterSetName='CreateWithTemplateJsonParameterJson', Mandatory, HelpMessage='The string representation of the JSON template.')] + [Parameter(ParameterSetName='CreateWithTemplateJsonParameterObject', Mandatory, HelpMessage='The string representation of the JSON template.')] + [Parameter(ParameterSetName='CreateRGWithTemplateJsonParameterFile', Mandatory, HelpMessage='The string representation of the JSON template.')] + [Parameter(ParameterSetName='CreateRGWithTemplateJsonParameterJson', Mandatory, HelpMessage='The string representation of the JSON template.')] + [Parameter(ParameterSetName='CreateRGWithTemplateJsonParameterObject', Mandatory, HelpMessage='The string representation of the JSON template.')] + [System.String] + # The string representation of the JSON template. + ${TemplateJson}, + + [Parameter(ParameterSetName='CreateWithTemplateObjectParameterFile', Mandatory, HelpMessage='The hashtable representation of the JSON template.')] + [Parameter(ParameterSetName='CreateRGWithTemplateObjectParameterFile', Mandatory, HelpMessage='The hashtable representation of the JSON template.')] + [Parameter(ParameterSetName='CreateWithTemplateObjectParameterJson', Mandatory, HelpMessage='The hashtable representation of the JSON template.')] + [Parameter(ParameterSetName='CreateRGWithTemplateObjectParameterJson', Mandatory, HelpMessage='The hashtable representation of the JSON template.')] + [Parameter(ParameterSetName='CreateWithTemplateObjectParameterObject', Mandatory, HelpMessage='The hashtable representation of the JSON template.')] + [Parameter(ParameterSetName='CreateRGWithTemplateObjectParameterObject', Mandatory, HelpMessage='The hashtable representation of the JSON template.')] + [System.Collections.Hashtable] + # The hashtable representation of the JSON template. + ${TemplateObject}, + + [Parameter(ParameterSetName='CreateWithTemplateFileParameterFile', Mandatory, HelpMessage='Local path to the parameter JSON template file.')] + [Parameter(ParameterSetName='CreateWithTemplateJsonParameterFile', Mandatory, HelpMessage='Local path to the parameter JSON template file.')] + [Parameter(ParameterSetName='CreateWithTemplateObjectParameterFile', Mandatory, HelpMessage='Local path to the parameter JSON template file.')] + [Parameter(ParameterSetName='CreateRGWithTemplateFileParameterFile', Mandatory, HelpMessage='Local path to the parameter JSON template file.')] + [Parameter(ParameterSetName='CreateRGWithTemplateJsonParameterFile', Mandatory, HelpMessage='Local path to the parameter JSON template file.')] + [Parameter(ParameterSetName='CreateRGWithTemplateObjectParameterFile', Mandatory, HelpMessage='Local path to the parameter JSON template file.')] + [System.String] + # Local path to the parameter JSON template file. + ${TemplateParameterFile}, + + [Parameter(ParameterSetName='CreateWithTemplateFileParameterJson', Mandatory, HelpMessage='The string representation of the parameter JSON template.')] + [Parameter(ParameterSetName='CreateWithTemplateJsonParameterJson', Mandatory, HelpMessage='The string representation of the parameter JSON template.')] + [Parameter(ParameterSetName='CreateWithTemplateObjectParameterJson', Mandatory, HelpMessage='The string representation of the parameter JSON template.')] + [Parameter(ParameterSetName='CreateRGWithTemplateFileParameterJson', Mandatory, HelpMessage='The string representation of the parameter JSON template.')] + [Parameter(ParameterSetName='CreateRGWithTemplateJsonParameterJson', Mandatory, HelpMessage='The string representation of the parameter JSON template.')] + [Parameter(ParameterSetName='CreateRGWithTemplateObjectParameterJson', Mandatory, HelpMessage='The string representation of the parameter JSON template.')] + [System.String] + # The string representation of the parameter JSON template. + ${TemplateParameterJson}, + + [Parameter(ParameterSetName='CreateWithTemplateFileParameterObject', Mandatory, HelpMessage='The hashtable representation of the parameter JSON template.')] + [Parameter(ParameterSetName='CreateRGWithTemplateFileParameterObject', Mandatory, HelpMessage='The hashtable representation of the parameter JSON template.')] + [Parameter(ParameterSetName='CreateWithTemplateJsonParameterObject', Mandatory, HelpMessage='The hashtable representation of the parameter JSON template.')] + [Parameter(ParameterSetName='CreateRGWithTemplateJsonParameterObject', Mandatory, HelpMessage='The hashtable representation of the parameter JSON template.')] + [Parameter(ParameterSetName='CreateWithTemplateObjectParameterObject', Mandatory, HelpMessage='The hashtable representation of the parameter JSON template.')] + [Parameter(ParameterSetName='CreateRGWithTemplateObjectParameterObject', Mandatory, HelpMessage='The hashtable representation of the parameter JSON template.')] + [System.Collections.Hashtable] + # The hashtable representation of the parameter JSON template. + ${TemplateParameterObject}, + + [Parameter(Mandatory, HelpMessage='The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources.')] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Resources.Support.DeploymentMode])] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Runtime.Info(SerializedName='mode', Required, PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Resources.Support.DeploymentMode]), Description='The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources.')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Support.DeploymentMode] + # The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + ${Mode}, + + [Parameter(HelpMessage='Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations.')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Runtime.Info(SerializedName='detailLevel', PossibleTypes=([System.String]), Description='Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations.')] + [System.String] + # Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. + ${DeploymentDebugLogLevel}, + + [Parameter(HelpMessage='The location to store the deployment data.')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Runtime.Info(SerializedName='location', PossibleTypes=([System.String]), Description='The location to store the deployment data.')] + [System.String] + # The location to store the deployment data. + ${Location}, + + [Parameter(HelpMessage='The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.')] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(HelpMessage='Run the command as a job')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(HelpMessage='Run the command asynchronously')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait} + + ) + + process { + if ($PSBoundParameters.ContainsKey("TemplateFile")) + { + if (!(Test-Path -Path $TemplateFile)) + { + throw "Unable to find template file '$TemplateFile'." + } + + if (!$PSBoundParameters.ContainsKey("Name")) + { + $DeploymentName = (Get-Item -Path $TemplateFile).BaseName + $null = $PSBoundParameters.Add("Name", $DeploymentName) + } + + $TemplateJson = [System.IO.File]::ReadAllText($TemplateFile) + $null = $PSBoundParameters.Add("Template", $TemplateJson) + $null = $PSBoundParameters.Remove("TemplateFile") + } + elseif ($PSBoundParameters.ContainsKey("TemplateJson")) + { + $null = $PSBoundParameters.Add("Template", $TemplateJson) + $null = $PSBoundParameters.Remove("TemplateJson") + } + elseif ($PSBoundParameters.ContainsKey("TemplateObject")) + { + $TemplateJson = ConvertTo-Json -InputObject $TemplateObject + $null = $PSBoundParameters.Add("Template", $TemplateJson) + $null = $PSBoundParameters.Remove("TemplateObject") + } + + if ($PSBoundParameters.ContainsKey("TemplateParameterFile")) + { + if (!(Test-Path -Path $TemplateParameterFile)) + { + throw "Unable to find template parameter file '$TemplateParameterFile'." + } + + $ParameterJson = [System.IO.File]::ReadAllText($TemplateParameterFile) + $ParameterObject = ConvertFrom-Json -InputObject $ParameterJson + $ParameterHashtable = @{} + $ParameterObject.PSObject.Properties | ForEach-Object { $ParameterHashtable[$_.Name] = $_.Value } + $ParameterHashtable.Remove("`$schema") + $ParameterHashtable.Remove("contentVersion") + $NestedValues = $ParameterHashtable.parameters + if ($null -ne $NestedValues) + { + $ParameterHashtable.Remove("parameters") + $NestedValues.PSObject.Properties | ForEach-Object { $ParameterHashtable[$_.Name] = $_.Value } + } + + $ParameterJson = ConvertTo-Json -InputObject $ParameterHashtable + $null = $PSBoundParameters.Add("DeploymentPropertyParameter", $ParameterJson) + $null = $PSBoundParameters.Remove("TemplateParameterFile") + } + elseif ($PSBoundParameters.ContainsKey("TemplateParameterJson")) + { + $null = $PSBoundParameters.Add("DeploymentPropertyParameter", $TemplateParameterJson) + $null = $PSBoundParameters.Remove("TemplateParameterJson") + } + elseif ($PSBoundParameters.ContainsKey("TemplateParameterObject")) + { + $TemplateParameterObject.Remove("`$schema") + $TemplateParameterObject.Remove("contentVersion") + $NestedValues = $TemplateParameterObject.parameters + if ($null -ne $NestedValues) + { + $TemplateParameterObject.Remove("parameters") + $NestedValues.PSObject.Properties | ForEach-Object { $TemplateParameterObject[$_.Name] = $_.Value } + } + + $TemplateParameterJson = ConvertTo-Json -InputObject $TemplateParameterObject + $null = $PSBoundParameters.Add("DeploymentPropertyParameter", $TemplateParameterJson) + $null = $PSBoundParameters.Remove("TemplateParameterObject") + } + + if (!$PSBoundParameters.ContainsKey("Name")) + { + $DeploymentName = (New-Guid).Guid + $null = $PSBoundParameters.Add("Name", $DeploymentName) + } + + if ($PSBoundParameters.ContainsKey("ResourceGroupName")) + { + Az.Resources.TestSupport.private\New-AzDeployment_CreateExpanded @PSBoundParameters + } + else + { + Az.Resources.TestSupport.private\New-AzDeployment_CreateExpanded @PSBoundParameters + } + } +} \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/docs/README.md b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/docs/README.md new file mode 100644 index 00000000000..3b56cb561c1 --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/docs/README.md @@ -0,0 +1,11 @@ +# Docs +This directory contains the documentation of the cmdlets for the `Az.Resources` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overriden on regeneration*. To update documentation examples, please use the `..\examples` folder. + +## Info +- Modifiable: no +- Generated: all +- Committed: yes +- Packaged: yes + +## Details +The process of documentation generation loads `Az.Resources` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder. \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/examples/README.md b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/examples/README.md new file mode 100644 index 00000000000..ac871d71fc7 --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/examples/README.md @@ -0,0 +1,11 @@ +# Examples +This directory contains examples from the exported cmdlets of the module. When `build-module.ps1` is ran, example stub files will be generated here. If your module support Azure Profiles, the example stubs will be in individual profile folders. These example stubs should be updated to show how the cmdlet is used. The examples are imported into the documentation when `generate-help.ps1` is ran. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Purpose +This separates the example documentation details from the generated documentation information provided directly from the generated cmdlets. Since the cmdlets don't have examples from the REST spec, this provides a means to add examples easily. The example stubs provide the markdown format that is required. The 3 core elements are: the name of the example, the code information of the example, and the description of the example. That information, if the markdown format is followed, will be available to documentation generation and be part of the documents in the `..\docs` folder. \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/how-to.md b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/how-to.md new file mode 100644 index 00000000000..129cad12cc3 --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/how-to.md @@ -0,0 +1,60 @@ +# How-To +This document describes how to develop for `Az.Resources`. + +## Building `Az.Resources` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [README.md](exports/README.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [README.md](custom/README.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [README.md](examples/README.md) in the `examples` folder. To read more about documentation, look at the [README.md](docs/README.md) in the `docs` folder. + +## Testing `Az.Resources` +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder. + +## Packing `Az.Resources` +To pack `Az.Resources` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.Resources`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.Resources.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.Resources.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.Resources`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.Resources` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `generate-portal-ux.ps1` + - Generates a folder dedicated to Azure-specific content and includes metadata files essential for enhancing the user experience (UX) within the Azure portal. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/license.txt b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/license.txt new file mode 100644 index 00000000000..3d3f8f90d5d --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/license.txt @@ -0,0 +1,203 @@ +MICROSOFT SOFTWARE LICENSE TERMS + +MICROSOFT AZURE POWERSHELL + +These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. + +BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE. + + +-----------------START OF LICENSE-------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +-------------------END OF LICENSE------------------------------------------ + + +----------------START OF THIRD PARTY NOTICE-------------------------------- + +The software includes Newtonsoft.Json. The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software. + +Newtonsoft.Json + +The MIT License (MIT) +Copyright (c) 2007 James Newton-King +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +-------------END OF THIRD PARTY NOTICE---------------------------------------- + diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/resources/CmdletSurface-latest-2019-04-30.md b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/resources/CmdletSurface-latest-2019-04-30.md new file mode 100644 index 00000000000..278ea694e0f --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/resources/CmdletSurface-latest-2019-04-30.md @@ -0,0 +1,598 @@ +### AzADApplication [Get, New, Remove, Update] `IApplication, Boolean` + - TenantId `String` + - ObjectId `String` + - IncludeDeleted `SwitchParameter` + - InputObject `IResourcesIdentity` + - HardDelete `SwitchParameter` + - Filter `String` + - IdentifierUri `String` + - DisplayNameStartWith `String` + - DisplayName `String` + - ApplicationId `String` + - AllowGuestsSignIn `SwitchParameter` + - AllowPassthroughUser `SwitchParameter` + - AppLogoUrl `String` + - AppPermission `String[]` + - AppRole `IAppRole[]` + - AvailableToOtherTenants `SwitchParameter` + - ErrorUrl `String` + - GroupMembershipClaim `GroupMembershipClaimTypes` + - Homepage `String` + - InformationalUrlMarketing `String` + - InformationalUrlPrivacy `String` + - InformationalUrlSupport `String` + - InformationalUrlTermsOfService `String` + - IsDeviceOnlyAuthSupported `SwitchParameter` + - KeyCredentials `IKeyCredential[]` + - KnownClientApplication `String[]` + - LogoutUrl `String` + - Oauth2AllowImplicitFlow `SwitchParameter` + - Oauth2AllowUrlPathMatching `SwitchParameter` + - Oauth2Permission `IOAuth2Permission[]` + - Oauth2RequirePostResponse `SwitchParameter` + - OptionalClaimAccessToken `IOptionalClaim[]` + - OptionalClaimIdToken `IOptionalClaim[]` + - OptionalClaimSamlToken `IOptionalClaim[]` + - OrgRestriction `String[]` + - PasswordCredentials `IPasswordCredential[]` + - PreAuthorizedApplication `IPreAuthorizedApplication[]` + - PublicClient `SwitchParameter` + - PublisherDomain `String` + - ReplyUrl `String[]` + - RequiredResourceAccess `IRequiredResourceAccess[]` + - SamlMetadataUrl `String` + - SignInAudience `String` + - WwwHomepage `String` + - Parameter `IApplicationCreateParameters` + - PassThru `SwitchParameter` + - AvailableToOtherTenant `SwitchParameter` + +### AzADApplicationOwner [Add, Get, Remove] `Boolean, IDirectoryObject` + - ObjectId `String` + - TenantId `String` + - InputObject `IResourcesIdentity` + - OwnerObjectId `String` + - AdditionalProperties `Hashtable` + - Url `String` + - Parameter `IAddOwnerParameters` + +### AzADDeletedApplication [Restore] `IApplication` + - ObjectId `String` + - TenantId `String` + - InputObject `IResourcesIdentity` + +### AzADGroup [Get, New, Remove] `IAdGroup, Boolean` + - TenantId `String` + - ObjectId `String` + - InputObject `IResourcesIdentity` + - Filter `String` + - DisplayNameStartsWith `String` + - DisplayName `String` + - AdditionalProperties `Hashtable` + - MailNickname `String` + - Parameter `IGroupCreateParameters` + - PassThru `SwitchParameter` + +### AzADGroupMember [Add, Get, Remove, Test] `Boolean, IDirectoryObject, SwitchParameter` + - GroupObjectId `String` + - TenantId `String` + - MemberObjectId `String[]` + - MemberUserPrincipalName `String[]` + - GroupObject `IAdGroup` + - GroupDisplayName `String` + - InputObject `IResourcesIdentity` + - ObjectId `String` + - ShowOwner `SwitchParameter` + - PassThru `SwitchParameter` + - AdditionalProperties `Hashtable` + - Url `String` + - Parameter `IGroupAddMemberParameters` + - DisplayName `String` + - GroupId `String` + - MemberId `String` + +### AzADGroupMemberGroup [Get] `String` + - ObjectId `String` + - TenantId `String` + - InputObject `IResourcesIdentity` + - AdditionalProperties `Hashtable` + - SecurityEnabledOnly `SwitchParameter` + - Parameter `IGroupGetMemberGroupsParameters` + +### AzADGroupOwner [Add, Remove] `Boolean` + - ObjectId `String` + - TenantId `String` + - GroupObjectId `String` + - MemberObjectId `String[]` + - InputObject `IResourcesIdentity` + - OwnerObjectId `String` + - PassThru `SwitchParameter` + - AdditionalProperties `Hashtable` + - Url `String` + - Parameter `IAddOwnerParameters` + +### AzADObject [Get] `IDirectoryObject` + - TenantId `String` + - InputObject `IResourcesIdentity` + - AdditionalProperties `Hashtable` + - IncludeDirectoryObjectReference `SwitchParameter` + - ObjectId `String[]` + - Type `String[]` + - Parameter `IGetObjectsParameters` + +### AzADServicePrincipal [Get, New, Remove, Update] `IServicePrincipal, Boolean` + - TenantId `String` + - ObjectId `String` + - InputObject `IResourcesIdentity` + - Filter `String` + - ApplicationObject `IApplication` + - ServicePrincipalName `String` + - DisplayNameBeginsWith `String` + - DisplayName `String` + - ApplicationId `String` + - AccountEnabled `SwitchParameter` + - AppId `String` + - AppRoleAssignmentRequired `SwitchParameter` + - KeyCredentials `IKeyCredential[]` + - PasswordCredentials `IPasswordCredential[]` + - ServicePrincipalType `String` + - Tag `String[]` + - Parameter `IServicePrincipalCreateParameters` + - PassThru `SwitchParameter` + +### AzADServicePrincipalOwner [Get] `IDirectoryObject` + - ObjectId `String` + - TenantId `String` + +### AzADUser [Get, New, Remove, Update] `IUser, Boolean` + - TenantId `String` + - UpnOrObjectId `String` + - InputObject `IResourcesIdentity` + - Filter `String` + - DisplayName `String` + - StartsWith `String` + - Mail `String` + - MailNickname `String` + - Parameter `IUserCreateParameters` + - AccountEnabled `SwitchParameter` + - GivenName `String` + - ImmutableId `String` + - PasswordProfile `IPasswordProfile` + - Surname `String` + - UsageLocation `String` + - UserPrincipalName `String` + - UserType `UserType` + - PassThru `SwitchParameter` + - EnableAccount `SwitchParameter` + +### AzADUserMemberGroup [Get] `String` + - ObjectId `String` + - TenantId `String` + - InputObject `IResourcesIdentity` + - AdditionalProperties `Hashtable` + - SecurityEnabledOnly `SwitchParameter` + - Parameter `IUserGetMemberGroupsParameters` + +### AzApplicationKeyCredentials [Get, Update] `IKeyCredential, Boolean` + - ObjectId `String` + - TenantId `String` + - InputObject `IResourcesIdentity` + - Parameter `IKeyCredentialsUpdateParameters` + - Value `IKeyCredential[]` + +### AzApplicationPasswordCredentials [Get, Update] `IPasswordCredential, Boolean` + - ObjectId `String` + - TenantId `String` + - InputObject `IResourcesIdentity` + - Parameter `IPasswordCredentialsUpdateParameters` + - Value `IPasswordCredential[]` + +### AzAuthorizationOperation [Get] `IOperation` + +### AzClassicAdministrator [Get] `IClassicAdministrator` + - SubscriptionId `String[]` + +### AzDenyAssignment [Get] `IDenyAssignment` + - Id `String` + - Scope `String` + - InputObject `IResourcesIdentity` + - ParentResourcePath `String` + - ResourceGroupName `String` + - ResourceName `String` + - ResourceProviderNamespace `String` + - ResourceType `String` + - SubscriptionId `String[]` + - Filter `String` + +### AzDeployment [Get, New, Remove, Set, Stop, Test] `IDeploymentExtended, Boolean, IDeploymentValidateResult` + - SubscriptionId `String[]` + - Name `String` + - ResourceGroupName `String` + - Id `String` + - InputObject `IResourcesIdentity` + - Filter `String` + - Top `Int32` + - Parameter `IDeployment` + - DebugSettingDetailLevel `String` + - Location `String` + - Mode `DeploymentMode` + - OnErrorDeploymentName `String` + - OnErrorDeploymentType `OnErrorDeploymentType` + - ParameterLinkContentVersion `String` + - ParameterLinkUri `String` + - Template `IDeploymentPropertiesTemplate` + - TemplateLinkContentVersion `String` + - TemplateLinkUri `String` + - PassThru `SwitchParameter` + +### AzDeploymentExistence [Test] `Boolean` + - DeploymentName `String` + - SubscriptionId `String` + - ResourceGroupName `String` + - InputObject `IResourcesIdentity` + +### AzDeploymentOperation [Get] `IDeploymentOperation` + - DeploymentName `String` + - SubscriptionId `String[]` + - ResourceGroupName `String` + - OperationId `String` + - DeploymentObject `IDeploymentExtended` + - InputObject `IResourcesIdentity` + - Top `Int32` + +### AzDeploymentTemplate [Export] `IDeploymentExportResultTemplate` + - DeploymentName `String` + - SubscriptionId `String` + - ResourceGroupName `String` + - InputObject `IResourcesIdentity` + +### AzDomain [Get] `IDomain` + - TenantId `String` + - Name `String` + - InputObject `IResourcesIdentity` + - Filter `String` + +### AzElevateGlobalAdministratorAccess [Invoke] `Boolean` + +### AzEntity [Get] `IEntityInfo` + - Filter `String` + - GroupName `String` + - Search `String` + - Select `String` + - Skip `Int32` + - Skiptoken `String` + - Top `Int32` + - View `String` + - CacheControl `String` + +### AzManagedApplication [Get, New, Remove, Set, Update] `IApplication, Boolean` + - Id `String` + - Name `String` + - ResourceGroupName `String` + - SubscriptionId `String[]` + - InputObject `IResourcesIdentity` + - Parameter `IApplication` + - ApplicationDefinitionId `String` + - IdentityType `ResourceIdentityType` + - Kind `String` + - Location `String` + - ManagedBy `String` + - ManagedResourceGroupId `String` + - PlanName `String` + - PlanProduct `String` + - PlanPromotionCode `String` + - PlanPublisher `String` + - PlanVersion `String` + - SkuCapacity `Int32` + - SkuFamily `String` + - SkuModel `String` + - SkuName `String` + - SkuSize `String` + - SkuTier `String` + - Tag `Hashtable` + +### AzManagedApplicationDefinition [Get, New, Remove, Set] `IApplicationDefinition, Boolean` + - Id `String` + - Name `String` + - ResourceGroupName `String` + - SubscriptionId `String[]` + - InputObject `IResourcesIdentity` + - Parameter `IApplicationDefinition` + - Artifact `IApplicationArtifact[]` + - Authorization `IApplicationProviderAuthorization[]` + - CreateUiDefinition `IApplicationDefinitionPropertiesCreateUiDefinition` + - Description `String` + - DisplayName `String` + - IdentityType `ResourceIdentityType` + - IsEnabled `String` + - Location `String` + - LockLevel `ApplicationLockLevel` + - MainTemplate `IApplicationDefinitionPropertiesMainTemplate` + - ManagedBy `String` + - PackageFileUri `String` + - SkuCapacity `Int32` + - SkuFamily `String` + - SkuModel `String` + - SkuName `String` + - SkuSize `String` + - SkuTier `String` + - Tag `Hashtable` + +### AzManagementGroup [Get, New, Remove, Set, Update] `IManagementGroup, IManagementGroupInfo, Boolean` + - GroupId `String` + - InputObject `IResourcesIdentity` + - Skiptoken `String` + - Expand `String` + - Filter `String` + - Recurse `SwitchParameter` + - CacheControl `String` + - DisplayName `String` + - Name `String` + - ParentId `String` + - CreateManagementGroupRequest `ICreateManagementGroupRequest` + - PatchGroupRequest `IPatchManagementGroupRequest` + +### AzManagementGroupDescendant [Get] `IDescendantInfo` + - GroupId `String` + - InputObject `IResourcesIdentity` + - Skiptoken `String` + - Top `Int32` + +### AzManagementGroupSubscription [New, Remove] `Boolean` + - GroupId `String` + - SubscriptionId `String` + - InputObject `IResourcesIdentity` + - CacheControl `String` + +### AzManagementLock [Get, New, Remove, Set] `IManagementLockObject, Boolean` + - SubscriptionId `String[]` + - LockName `String` + - ResourceGroupName `String` + - ParentResourcePath `String` + - ResourceName `String` + - ResourceProviderNamespace `String` + - ResourceType `String` + - Scope `String` + - InputObject `IResourcesIdentity` + - Filter `String` + - Level `LockLevel` + - Note `String` + - Owner `IManagementLockOwner[]` + - Parameter `IManagementLockObject` + +### AzNameAvailability [Test] `ICheckNameAvailabilityResult` + - Name `String` + - Type `Type` + - CheckNameAvailabilityRequest `ICheckNameAvailabilityRequest` + +### AzOAuth2PermissionGrant [Get, New, Remove] `IOAuth2PermissionGrant, Boolean` + - TenantId `String` + - InputObject `IResourcesIdentity` + - Filter `String` + - ClientId `String` + - ConsentType `ConsentType` + - ExpiryTime `String` + - ObjectId `String` + - OdataType `String` + - PrincipalId `String` + - ResourceId `String` + - Scope `String` + - StartTime `String` + - Body `IOAuth2PermissionGrant` + +### AzPermission [Get] `IPermission` + - ResourceGroupName `String` + - SubscriptionId `String[]` + - ParentResourcePath `String` + - ResourceName `String` + - ResourceProviderNamespace `String` + - ResourceType `String` + +### AzPolicyAssignment [Get, New, Remove] `IPolicyAssignment` + - Id `String` + - Name `String` + - Scope `String` + - InputObject `IResourcesIdentity` + - ParentResourcePath `String` + - ResourceGroupName `String` + - ResourceName `String` + - ResourceProviderNamespace `String` + - ResourceType `String` + - SubscriptionId `String[]` + - PolicyDefinitionId `String` + - IncludeDescendent `SwitchParameter` + - Filter `String` + - Parameter `IPolicyAssignment` + - Description `String` + - DisplayName `String` + - IdentityType `ResourceIdentityType` + - Location `String` + - Metadata `IPolicyAssignmentPropertiesMetadata` + - NotScope `String[]` + - SkuName `String` + - SkuTier `String` + - PropertiesScope `String` + +### AzPolicyDefinition [Get, New, Remove, Set] `IPolicyDefinition, Boolean` + - SubscriptionId `String[]` + - Name `String` + - ManagementGroupName `String` + - Id `String` + - InputObject `IResourcesIdentity` + - BuiltIn `SwitchParameter` + - Parameter `IPolicyDefinition` + - Description `String` + - DisplayName `String` + - Metadata `IPolicyDefinitionPropertiesMetadata` + - Mode `PolicyMode` + - PolicyRule `IPolicyDefinitionPropertiesPolicyRule` + - PolicyType `PolicyType` + - PassThru `SwitchParameter` + +### AzPolicySetDefinition [Get, New, Remove, Set] `IPolicySetDefinition, Boolean` + - SubscriptionId `String[]` + - Name `String` + - ManagementGroupName `String` + - Id `String` + - InputObject `IResourcesIdentity` + - BuiltIn `SwitchParameter` + - Parameter `IPolicySetDefinition` + - Description `String` + - DisplayName `String` + - Metadata `IPolicySetDefinitionPropertiesMetadata` + - PolicyDefinition `IPolicyDefinitionReference[]` + - PolicyType `PolicyType` + - PassThru `SwitchParameter` + +### AzProviderFeature [Get, Register] `IFeatureResult` + - SubscriptionId `String[]` + - Name `String` + - ResourceProviderNamespace `String` + - InputObject `IResourcesIdentity` + +### AzProviderOperationsMetadata [Get] `IProviderOperationsMetadata` + - ResourceProviderNamespace `String` + - InputObject `IResourcesIdentity` + - Expand `String` + +### AzResource [Get, Move, New, Remove, Set, Test, Update] `IGenericResource, Boolean` + - ResourceId `String` + - Name `String` + - ParentResourcePath `String` + - ProviderNamespace `String` + - ResourceGroupName `String` + - ResourceType `String` + - SubscriptionId `String[]` + - InputObject `IResourcesIdentity` + - SourceResourceGroupName `String` + - ResourceName `String` + - ResourceProviderNamespace `String` + - Expand `String` + - Top `Int32` + - TagName `String` + - TagValue `String` + - Tag `Hashtable` + - Filter `String` + - PassThru `SwitchParameter` + - Resource `String[]` + - TargetResourceGroup `String` + - TargetSubscriptionId `String` + - TargetResourceGroupName `String` + - Parameter `IResourcesMoveInfo` + - IdentityType `ResourceIdentityType` + - IdentityUserAssignedIdentity `Hashtable` + - Kind `String` + - Location `String` + - ManagedBy `String` + - PlanName `String` + - PlanProduct `String` + - PlanPromotionCode `String` + - PlanPublisher `String` + - PlanVersion `String` + - Property `IGenericResourceProperties` + - SkuCapacity `Int32` + - SkuFamily `String` + - SkuModel `String` + - SkuName `String` + - SkuSize `String` + - SkuTier `String` + +### AzResourceGroup [Export, Get, New, Remove, Set, Test, Update] `IResourceGroupExportResult, IResourceGroup, Boolean` + - ResourceGroupName `String` + - SubscriptionId `String` + - InputObject `IResourcesIdentity` + - Name `String` + - Id `String` + - Filter `String` + - Top `Int32` + - TagName `String` + - TagValue `String` + - Tag `Hashtable` + - Option `String` + - Resource `String[]` + - Parameter `IExportTemplateRequest` + - Location `String` + - ManagedBy `String` + +### AzResourceLink [Get, New, Remove, Set] `IResourceLink, Boolean` + - ResourceId `String` + - InputObject `IResourcesIdentity` + - SubscriptionId `String[]` + - Scope `String` + - FilterById `String` + - FilterByScope `Filter` + - Note `String` + - TargetId `String` + - Parameter `IResourceLink` + +### AzResourceMove [Test] `Boolean` + - SourceResourceGroupName `String` + - SubscriptionId `String` + - InputObject `IResourcesIdentity` + - PassThru `SwitchParameter` + - Resource `String[]` + - TargetResourceGroup `String` + - TargetSubscriptionId `String` + - TargetResourceGroupName `String` + - Parameter `IResourcesMoveInfo` + +### AzResourceProvider [Get, Register, Unregister] `IProvider` + - SubscriptionId `String[]` + - ResourceProviderNamespace `String` + - InputObject `IResourcesIdentity` + - Expand `String` + - Top `Int32` + +### AzResourceProviderOperationDetail [Get] `IResourceProviderOperationDefinition` + - ResourceProviderNamespace `String` + +### AzRoleAssignment [Get, New, Remove] `IRoleAssignment` + - Id `String` + - Name `String` + - Scope `String` + - RoleId `String` + - InputObject `IResourcesIdentity` + - ParentResourceId `String` + - ResourceGroupName `String` + - ResourceName `String` + - ResourceProviderNamespace `String` + - ResourceType `String` + - SubscriptionId `String[]` + - ExpandPrincipalGroups `String` + - ServicePrincipalName `String` + - SignInName `String` + - Filter `String` + - CanDelegate `SwitchParameter` + - PrincipalId `String` + - RoleDefinitionId `String` + - Parameter `IRoleAssignmentCreateParameters` + - PrincipalType `PrincipalType` + +### AzRoleDefinition [Get, New, Remove, Set] `IRoleDefinition` + - Id `String` + - Scope `String` + - InputObject `IResourcesIdentity` + - Name `String` + - Custom `SwitchParameter` + - Filter `String` + - AssignableScope `String[]` + - Description `String` + - Permission `IPermission[]` + - RoleName `String` + - RoleType `String` + - RoleDefinition `IRoleDefinition` + +### AzSubscriptionLocation [Get] `ILocation` + - SubscriptionId `String[]` + +### AzTag [Get, New, Remove] `ITagDetails, Boolean` + - SubscriptionId `String[]` + - Name `String` + - Value `String` + - InputObject `IResourcesIdentity` + - PassThru `SwitchParameter` + +### AzTenantBackfill [Start] `ITenantBackfillStatusResult` + +### AzTenantBackfillStatus [Invoke] `ITenantBackfillStatusResult` + diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/resources/ModelSurface.md b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/resources/ModelSurface.md new file mode 100644 index 00000000000..378e3ec418a --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/resources/ModelSurface.md @@ -0,0 +1,1645 @@ +### AddOwnerParameters \ [Api16] + - Url `String` + +### AdGroup \ [Api16] + - DeletionTimestamp `DateTime?` **{MinValue, MaxValue}** + - DisplayName `String` + - Mail `String` + - MailEnabled `Boolean?` + - MailNickname `String` + - ObjectId `String` + - ObjectType `String` + - SecurityEnabled `Boolean?` + +### AliasPathType [Api20180501] + - ApiVersion `String[]` + - Path `String` + +### AliasType [Api20180501] + - Name `String` + - Path `IAliasPathType[]` + +### Appliance [Api20160901Preview] + - DefinitionId `String` + - Id `String` + - Identity `IIdentity` + - IdentityPrincipalId `String` + - IdentityTenantId `String` + - IdentityType `ResourceIdentityType?` **{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned}** + - Kind `String` + - Location `String` + - ManagedBy `String` + - ManagedResourceGroupId `String` + - Name `String` + - Output `IAppliancePropertiesOutputs` + - Parameter `IAppliancePropertiesParameters` + - PlanName `String` + - PlanProduct `String` + - PlanPromotionCode `String` + - PlanPublisher `String` + - PlanVersion `String` + - ProvisioningState `String` + - Sku `ISku` + - SkuCapacity `Int32?` + - SkuFamily `String` + - SkuModel `String` + - SkuName `String` + - SkuSize `String` + - SkuTier `String` + - Tag `IResourceTags ` + - Type `String` + - UiDefinitionUri `String` + +### ApplianceArtifact [Api20160901Preview] + - Name `String` + - Type `ApplianceArtifactType?` **{Custom, Template}** + - Uri `String` + +### ApplianceDefinition [Api20160901Preview] + - Artifact `IApplianceArtifact[]` + - Authorization `IApplianceProviderAuthorization[]` + - Description `String` + - DisplayName `String` + - Id `String` + - Identity `IIdentity` + - IdentityPrincipalId `String` + - IdentityTenantId `String` + - IdentityType `ResourceIdentityType?` **{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned}** + - Location `String` + - LockLevel `ApplianceLockLevel` **{CanNotDelete, None, ReadOnly}** + - ManagedBy `String` + - Name `String` + - PackageFileUri `String` + - Sku `ISku` + - SkuCapacity `Int32?` + - SkuFamily `String` + - SkuModel `String` + - SkuName `String` + - SkuSize `String` + - SkuTier `String` + - Tag `IResourceTags ` + - Type `String` + +### ApplianceDefinitionListResult [Api20160901Preview] + - NextLink `String` + - Value `IApplianceDefinition[]` + +### ApplianceDefinitionProperties [Api20160901Preview] + - Artifact `IApplianceArtifact[]` + - Authorization `IApplianceProviderAuthorization[]` + - Description `String` + - DisplayName `String` + - LockLevel `ApplianceLockLevel` **{CanNotDelete, None, ReadOnly}** + - PackageFileUri `String` + +### ApplianceListResult [Api20160901Preview] + - NextLink `String` + - Value `IAppliance[]` + +### AppliancePatchable [Api20160901Preview] + - ApplianceDefinitionId `String` + - Id `String` + - Identity `IIdentity` + - IdentityPrincipalId `String` + - IdentityTenantId `String` + - IdentityType `ResourceIdentityType?` **{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned}** + - Kind `String` + - Location `String` + - ManagedBy `String` + - ManagedResourceGroupId `String` + - Name `String` + - Output `IAppliancePropertiesPatchableOutputs` + - Parameter `IAppliancePropertiesPatchableParameters` + - PlanName `String` + - PlanProduct `String` + - PlanPromotionCode `String` + - PlanPublisher `String` + - PlanVersion `String` + - ProvisioningState `String` + - Sku `ISku` + - SkuCapacity `Int32?` + - SkuFamily `String` + - SkuModel `String` + - SkuName `String` + - SkuSize `String` + - SkuTier `String` + - Tag `IResourceTags ` + - Type `String` + - UiDefinitionUri `String` + +### ApplianceProperties [Api20160901Preview] + - ApplianceDefinitionId `String` + - ManagedResourceGroupId `String` + - Output `IAppliancePropertiesOutputs` + - Parameter `IAppliancePropertiesParameters` + - ProvisioningState `String` + - UiDefinitionUri `String` + +### AppliancePropertiesPatchable [Api20160901Preview] + - ApplianceDefinitionId `String` + - ManagedResourceGroupId `String` + - Output `IAppliancePropertiesPatchableOutputs` + - Parameter `IAppliancePropertiesPatchableParameters` + - ProvisioningState `String` + - UiDefinitionUri `String` + +### ApplianceProviderAuthorization [Api20160901Preview] + - PrincipalId `String` + - RoleDefinitionId `String` + +### Application \ [Api16, Api20170901, Api20180601] + - AllowGuestsSignIn `Boolean?` + - AllowPassthroughUser `Boolean?` + - AppId `String` + - AppLogoUrl `String` + - AppPermission `String[]` + - AppRole `IAppRole[]` + - AvailableToOtherTenant `Boolean?` + - DefinitionId `String` + - DeletionTimestamp `DateTime?` **{MinValue, MaxValue}** + - DisplayName `String` + - ErrorUrl `String` + - GroupMembershipClaim `GroupMembershipClaimTypes?` **{All, None, SecurityGroup}** + - Homepage `String` + - Id `String` + - IdentifierUri `String[]` + - Identity `IIdentity` + - IdentityPrincipalId `String` + - IdentityTenantId `String` + - IdentityType `ResourceIdentityType?` **{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned}** + - InformationalUrlMarketing `String` + - InformationalUrlPrivacy `String` + - InformationalUrlSupport `String` + - InformationalUrlTermsOfService `String` + - IsDeviceOnlyAuthSupported `Boolean?` + - KeyCredentials `IKeyCredential[]` + - Kind `String` + - KnownClientApplication `String[]` + - Location `String` + - LogoutUrl `String` + - ManagedBy `String` + - ManagedResourceGroupId `String` + - Name `String` + - Oauth2AllowImplicitFlow `Boolean?` + - Oauth2AllowUrlPathMatching `Boolean?` + - Oauth2Permission `IOAuth2Permission[]` + - Oauth2RequirePostResponse `Boolean?` + - ObjectId `String` + - ObjectType `String` + - OptionalClaimAccessToken `IOptionalClaim[]` + - OptionalClaimIdToken `IOptionalClaim[]` + - OptionalClaimSamlToken `IOptionalClaim[]` + - OrgRestriction `String[]` + - Output `IApplicationPropertiesOutputs` + - Parameter `IApplicationPropertiesParameters` + - PasswordCredentials `IPasswordCredential[]` + - PlanName `String` + - PlanProduct `String` + - PlanPromotionCode `String` + - PlanPublisher `String` + - PlanVersion `String` + - PreAuthorizedApplication `IPreAuthorizedApplication[]` + - ProvisioningState `String` + - PublicClient `Boolean?` + - PublisherDomain `String` + - ReplyUrl `String[]` + - RequiredResourceAccess `IRequiredResourceAccess[]` + - SamlMetadataUrl `String` + - SignInAudience `String` + - Sku `ISku` + - SkuCapacity `Int32?` + - SkuFamily `String` + - SkuModel `String` + - SkuName `String` + - SkuSize `String` + - SkuTier `String` + - Tag `IResourceTags ` + - Type `String` + - UiDefinitionUri `String` + - WwwHomepage `String` + +### ApplicationArtifact [Api20170901] + - Name `String` + - Type `ApplicationArtifactType?` **{Custom, Template}** + - Uri `String` + +### ApplicationBase [Api16] + - AllowGuestsSignIn `Boolean?` + - AllowPassthroughUser `Boolean?` + - AppLogoUrl `String` + - AppPermission `String[]` + - AppRole `IAppRole[]` + - AvailableToOtherTenant `Boolean?` + - ErrorUrl `String` + - GroupMembershipClaim `GroupMembershipClaimTypes?` **{All, None, SecurityGroup}** + - Homepage `String` + - InformationalUrlMarketing `String` + - InformationalUrlPrivacy `String` + - InformationalUrlSupport `String` + - InformationalUrlTermsOfService `String` + - IsDeviceOnlyAuthSupported `Boolean?` + - KeyCredentials `IKeyCredential[]` + - KnownClientApplication `String[]` + - LogoutUrl `String` + - Oauth2AllowImplicitFlow `Boolean?` + - Oauth2AllowUrlPathMatching `Boolean?` + - Oauth2Permission `IOAuth2Permission[]` + - Oauth2RequirePostResponse `Boolean?` + - OptionalClaimAccessToken `IOptionalClaim[]` + - OptionalClaimIdToken `IOptionalClaim[]` + - OptionalClaimSamlToken `IOptionalClaim[]` + - OrgRestriction `String[]` + - PasswordCredentials `IPasswordCredential[]` + - PreAuthorizedApplication `IPreAuthorizedApplication[]` + - PublicClient `Boolean?` + - PublisherDomain `String` + - ReplyUrl `String[]` + - RequiredResourceAccess `IRequiredResourceAccess[]` + - SamlMetadataUrl `String` + - SignInAudience `String` + - WwwHomepage `String` + +### ApplicationCreateParameters [Api16] + - AllowGuestsSignIn `Boolean?` + - AllowPassthroughUser `Boolean?` + - AppLogoUrl `String` + - AppPermission `String[]` + - AppRole `IAppRole[]` + - AvailableToOtherTenant `Boolean?` + - DisplayName `String` + - ErrorUrl `String` + - GroupMembershipClaim `GroupMembershipClaimTypes?` **{All, None, SecurityGroup}** + - Homepage `String` + - IdentifierUri `String[]` + - InformationalUrl `IInformationalUrl` + - InformationalUrlMarketing `String` + - InformationalUrlPrivacy `String` + - InformationalUrlSupport `String` + - InformationalUrlTermsOfService `String` + - IsDeviceOnlyAuthSupported `Boolean?` + - KeyCredentials `IKeyCredential[]` + - KnownClientApplication `String[]` + - LogoutUrl `String` + - Oauth2AllowImplicitFlow `Boolean?` + - Oauth2AllowUrlPathMatching `Boolean?` + - Oauth2Permission `IOAuth2Permission[]` + - Oauth2RequirePostResponse `Boolean?` + - OptionalClaim `IOptionalClaims` + - OptionalClaimAccessToken `IOptionalClaim[]` + - OptionalClaimIdToken `IOptionalClaim[]` + - OptionalClaimSamlToken `IOptionalClaim[]` + - OrgRestriction `String[]` + - PasswordCredentials `IPasswordCredential[]` + - PreAuthorizedApplication `IPreAuthorizedApplication[]` + - PublicClient `Boolean?` + - PublisherDomain `String` + - ReplyUrl `String[]` + - RequiredResourceAccess `IRequiredResourceAccess[]` + - SamlMetadataUrl `String` + - SignInAudience `String` + - WwwHomepage `String` + +### ApplicationDefinition [Api20170901] + - Artifact `IApplicationArtifact[]` + - Authorization `IApplicationProviderAuthorization[]` + - CreateUiDefinition `IApplicationDefinitionPropertiesCreateUiDefinition` + - Description `String` + - DisplayName `String` + - Id `String` + - Identity `IIdentity` + - IdentityPrincipalId `String` + - IdentityTenantId `String` + - IdentityType `ResourceIdentityType?` **{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned}** + - IsEnabled `String` + - Location `String` + - LockLevel `ApplicationLockLevel` **{CanNotDelete, None, ReadOnly}** + - MainTemplate `IApplicationDefinitionPropertiesMainTemplate` + - ManagedBy `String` + - Name `String` + - PackageFileUri `String` + - Sku `ISku` + - SkuCapacity `Int32?` + - SkuFamily `String` + - SkuModel `String` + - SkuName `String` + - SkuSize `String` + - SkuTier `String` + - Tag `IResourceTags ` + - Type `String` + +### ApplicationDefinitionListResult [Api20180601] + - NextLink `String` + - Value `IApplicationDefinition[]` + +### ApplicationDefinitionProperties [Api20170901] + - Artifact `IApplicationArtifact[]` + - Authorization `IApplicationProviderAuthorization[]` + - CreateUiDefinition `IApplicationDefinitionPropertiesCreateUiDefinition` + - Description `String` + - DisplayName `String` + - IsEnabled `String` + - LockLevel `ApplicationLockLevel` **{CanNotDelete, None, ReadOnly}** + - MainTemplate `IApplicationDefinitionPropertiesMainTemplate` + - PackageFileUri `String` + +### ApplicationListResult [Api16, Api20180601] + - NextLink `String` + - OdataNextLink `String` + - Value `IApplication[]` + +### ApplicationPatchable [Api20170901, Api20180601] + - ApplicationDefinitionId `String` + - Id `String` + - Identity `IIdentity` + - IdentityPrincipalId `String` + - IdentityTenantId `String` + - IdentityType `ResourceIdentityType?` **{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned}** + - Kind `String` + - Location `String` + - ManagedBy `String` + - ManagedResourceGroupId `String` + - Name `String` + - Output `IApplicationPropertiesPatchableOutputs` + - Parameter `IApplicationPropertiesPatchableParameters` + - PlanName `String` + - PlanProduct `String` + - PlanPromotionCode `String` + - PlanPublisher `String` + - PlanVersion `String` + - ProvisioningState `String` + - Sku `ISku` + - SkuCapacity `Int32?` + - SkuFamily `String` + - SkuModel `String` + - SkuName `String` + - SkuSize `String` + - SkuTier `String` + - Tag `IResourceTags ` + - Type `String` + - UiDefinitionUri `String` + +### ApplicationProperties [Api20170901, Api20180601] + - ApplicationDefinitionId `String` + - ManagedResourceGroupId `String` + - Output `IApplicationPropertiesOutputs` + - Parameter `IApplicationPropertiesParameters` + - ProvisioningState `String` + - UiDefinitionUri `String` + +### ApplicationPropertiesPatchable [Api20170901, Api20180601] + - ApplicationDefinitionId `String` + - ManagedResourceGroupId `String` + - Output `IApplicationPropertiesPatchableOutputs` + - Parameter `IApplicationPropertiesPatchableParameters` + - ProvisioningState `String` + - UiDefinitionUri `String` + +### ApplicationProviderAuthorization [Api20170901] + - PrincipalId `String` + - RoleDefinitionId `String` + +### ApplicationUpdateParameters [Api16] + - AllowGuestsSignIn `Boolean?` + - AllowPassthroughUser `Boolean?` + - AppLogoUrl `String` + - AppPermission `String[]` + - AppRole `IAppRole[]` + - AvailableToOtherTenant `Boolean?` + - DisplayName `String` + - ErrorUrl `String` + - GroupMembershipClaim `GroupMembershipClaimTypes?` **{All, None, SecurityGroup}** + - Homepage `String` + - IdentifierUri `String[]` + - InformationalUrl `IInformationalUrl` + - InformationalUrlMarketing `String` + - InformationalUrlPrivacy `String` + - InformationalUrlSupport `String` + - InformationalUrlTermsOfService `String` + - IsDeviceOnlyAuthSupported `Boolean?` + - KeyCredentials `IKeyCredential[]` + - KnownClientApplication `String[]` + - LogoutUrl `String` + - Oauth2AllowImplicitFlow `Boolean?` + - Oauth2AllowUrlPathMatching `Boolean?` + - Oauth2Permission `IOAuth2Permission[]` + - Oauth2RequirePostResponse `Boolean?` + - OptionalClaim `IOptionalClaims` + - OptionalClaimAccessToken `IOptionalClaim[]` + - OptionalClaimIdToken `IOptionalClaim[]` + - OptionalClaimSamlToken `IOptionalClaim[]` + - OrgRestriction `String[]` + - PasswordCredentials `IPasswordCredential[]` + - PreAuthorizedApplication `IPreAuthorizedApplication[]` + - PublicClient `Boolean?` + - PublisherDomain `String` + - ReplyUrl `String[]` + - RequiredResourceAccess `IRequiredResourceAccess[]` + - SamlMetadataUrl `String` + - SignInAudience `String` + - WwwHomepage `String` + +### AppRole [Api16] + - AllowedMemberType `String[]` + - Description `String` + - DisplayName `String` + - Id `String` + - IsEnabled `Boolean?` + - Value `String` + +### BasicDependency [Api20180501] + - Id `String` + - ResourceName `String` + - ResourceType `String` + +### CheckGroupMembershipParameters \ [Api16] + - GroupId `String` + - MemberId `String` + +### CheckGroupMembershipResult \ [Api16] + - Value `Boolean?` + +### CheckNameAvailabilityRequest [Api20180301Preview] + - Name `String` + - Type `Type?` **{ProvidersMicrosoftManagementGroups}** + +### CheckNameAvailabilityResult [Api20180301Preview] + - Message `String` + - NameAvailable `Boolean?` + - Reason `Reason?` **{AlreadyExists, Invalid}** + +### ClassicAdministrator [Api20150701] + - EmailAddress `String` + - Id `String` + - Name `String` + - Role `String` + - Type `String` + +### ClassicAdministratorListResult [Api20150701] + - NextLink `String` + - Value `IClassicAdministrator[]` + +### ClassicAdministratorProperties [Api20150701] + - EmailAddress `String` + - Role `String` + +### ComponentsSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties [Api20180501] + - ClientId `String` + - PrincipalId `String` + +### CreateManagementGroupChildInfo [Api20180301Preview] + - Child `ICreateManagementGroupChildInfo[]` + - DisplayName `String` + - Id `String` + - Name `String` + - Role `String[]` + - Type `String` + +### CreateManagementGroupDetails [Api20180301Preview] + - ParentDisplayName `String` + - ParentId `String` + - ParentName `String` + - UpdatedBy `String` + - UpdatedTime `DateTime?` **{MinValue, MaxValue}** + - Version `Single?` + +### CreateManagementGroupProperties [Api20180301Preview] + - Child `ICreateManagementGroupChildInfo[]` + - DetailUpdatedBy `String` + - DetailUpdatedTime `DateTime?` **{MinValue, MaxValue}** + - DetailVersion `Single?` + - DisplayName `String` + - ParentDisplayName `String` + - ParentId `String` + - ParentName `String` + - Role `String[]` + - TenantId `String` + +### CreateManagementGroupRequest [Api20180301Preview] + - Child `ICreateManagementGroupChildInfo[]` + - DetailUpdatedBy `String` + - DetailUpdatedTime `DateTime?` **{MinValue, MaxValue}** + - DetailVersion `Single?` + - DisplayName `String` + - Id `String` + - Name `String` + - ParentDisplayName `String` + - ParentId `String` + - ParentName `String` + - Role `String[]` + - TenantId `String` + - Type `String` + +### CreateParentGroupInfo [Api20180301Preview] + - DisplayName `String` + - Id `String` + - Name `String` + +### DebugSetting [Api20180501] + - DetailLevel `String` + +### DenyAssignment [Api20180701Preview] + - DenyAssignmentName `String` + - Description `String` + - DoNotApplyToChildScope `Boolean?` + - ExcludePrincipal `IPrincipal[]` + - Id `String` + - IsSystemProtected `Boolean?` + - Name `String` + - Permission `IDenyAssignmentPermission[]` + - Principal `IPrincipal[]` + - Scope `String` + - Type `String` + +### DenyAssignmentListResult [Api20180701Preview] + - NextLink `String` + - Value `IDenyAssignment[]` + +### DenyAssignmentPermission [Api20180701Preview] + - Action `String[]` + - DataAction `String[]` + - NotAction `String[]` + - NotDataAction `String[]` + +### DenyAssignmentProperties [Api20180701Preview] + - DenyAssignmentName `String` + - Description `String` + - DoNotApplyToChildScope `Boolean?` + - ExcludePrincipal `IPrincipal[]` + - IsSystemProtected `Boolean?` + - Permission `IDenyAssignmentPermission[]` + - Principal `IPrincipal[]` + - Scope `String` + +### Dependency [Api20180501] + - DependsOn `IBasicDependency[]` + - Id `String` + - ResourceName `String` + - ResourceType `String` + +### Deployment [Api20180501] + - DebugSettingDetailLevel `String` + - Location `String` + - Mode `DeploymentMode` **{Complete, Incremental}** + - OnErrorDeploymentName `String` + - OnErrorDeploymentType `OnErrorDeploymentType?` **{LastSuccessful, SpecificDeployment}** + - Parameter `IDeploymentPropertiesParameters` + - ParameterLinkContentVersion `String` + - ParameterLinkUri `String` + - Template `IDeploymentPropertiesTemplate` + - TemplateLinkContentVersion `String` + - TemplateLinkUri `String` + +### DeploymentExportResult [Api20180501] + - Template `IDeploymentExportResultTemplate` + +### DeploymentExtended [Api20180501] + - CorrelationId `String` + - DebugSettingDetailLevel `String` + - Dependency `IDependency[]` + - Id `String` + - Location `String` + - Mode `DeploymentMode?` **{Complete, Incremental}** + - Name `String` + - OnErrorDeploymentName `String` + - OnErrorDeploymentProvisioningState `String` + - OnErrorDeploymentType `OnErrorDeploymentType?` **{LastSuccessful, SpecificDeployment}** + - Output `IDeploymentPropertiesExtendedOutputs` + - Parameter `IDeploymentPropertiesExtendedParameters` + - ParameterLinkContentVersion `String` + - ParameterLinkUri `String` + - Provider `IProvider[]` + - ProvisioningState `String` + - Template `IDeploymentPropertiesExtendedTemplate` + - TemplateLinkContentVersion `String` + - TemplateLinkUri `String` + - Timestamp `DateTime?` **{MinValue, MaxValue}** + - Type `String` + +### DeploymentListResult [Api20180501] + - NextLink `String` + - Value `IDeploymentExtended[]` + +### DeploymentOperation [Api20180501] + - Id `String` + - OperationId `String` + - ProvisioningState `String` + - RequestContent `IHttpMessageContent` + - ResponseContent `IHttpMessageContent` + - ServiceRequestId `String` + - StatusCode `String` + - StatusMessage `IDeploymentOperationPropertiesStatusMessage` + - TargetResourceId `String` + - TargetResourceName `String` + - TargetResourceType `String` + - Timestamp `DateTime?` **{MinValue, MaxValue}** + +### DeploymentOperationProperties [Api20180501] + - ProvisioningState `String` + - RequestContent `IHttpMessageContent` + - ResponseContent `IHttpMessageContent` + - ServiceRequestId `String` + - StatusCode `String` + - StatusMessage `IDeploymentOperationPropertiesStatusMessage` + - TargetResourceId `String` + - TargetResourceName `String` + - TargetResourceType `String` + - Timestamp `DateTime?` **{MinValue, MaxValue}** + +### DeploymentOperationsListResult [Api20180501] + - NextLink `String` + - Value `IDeploymentOperation[]` + +### DeploymentProperties [Api20180501] + - DebugSettingDetailLevel `String` + - Mode `DeploymentMode` **{Complete, Incremental}** + - OnErrorDeploymentName `String` + - OnErrorDeploymentType `OnErrorDeploymentType?` **{LastSuccessful, SpecificDeployment}** + - Parameter `IDeploymentPropertiesParameters` + - ParameterLinkContentVersion `String` + - ParameterLinkUri `String` + - Template `IDeploymentPropertiesTemplate` + - TemplateLinkContentVersion `String` + - TemplateLinkUri `String` + +### DeploymentPropertiesExtended [Api20180501] + - CorrelationId `String` + - DebugSettingDetailLevel `String` + - Dependency `IDependency[]` + - Mode `DeploymentMode?` **{Complete, Incremental}** + - OnErrorDeploymentName `String` + - OnErrorDeploymentProvisioningState `String` + - OnErrorDeploymentType `OnErrorDeploymentType?` **{LastSuccessful, SpecificDeployment}** + - Output `IDeploymentPropertiesExtendedOutputs` + - Parameter `IDeploymentPropertiesExtendedParameters` + - ParameterLinkContentVersion `String` + - ParameterLinkUri `String` + - Provider `IProvider[]` + - ProvisioningState `String` + - Template `IDeploymentPropertiesExtendedTemplate` + - TemplateLinkContentVersion `String` + - TemplateLinkUri `String` + - Timestamp `DateTime?` **{MinValue, MaxValue}** + +### DeploymentValidateResult [Api20180501] + - CorrelationId `String` + - DebugSettingDetailLevel `String` + - Dependency `IDependency[]` + - ErrorCode `String` + - ErrorDetail `IResourceManagementErrorWithDetails[]` + - ErrorMessage `String` + - ErrorTarget `String` + - Mode `DeploymentMode?` **{Complete, Incremental}** + - OnErrorDeploymentName `String` + - OnErrorDeploymentProvisioningState `String` + - OnErrorDeploymentType `OnErrorDeploymentType?` **{LastSuccessful, SpecificDeployment}** + - Output `IDeploymentPropertiesExtendedOutputs` + - Parameter `IDeploymentPropertiesExtendedParameters` + - ParameterLinkContentVersion `String` + - ParameterLinkUri `String` + - Provider `IProvider[]` + - ProvisioningState `String` + - Template `IDeploymentPropertiesExtendedTemplate` + - TemplateLinkContentVersion `String` + - TemplateLinkUri `String` + - Timestamp `DateTime?` **{MinValue, MaxValue}** + +### DescendantInfo [Api20180301Preview] + - DisplayName `String` + - Id `String` + - Name `String` + - ParentId `String` + - Type `String` + +### DescendantInfoProperties [Api20180301Preview] + - DisplayName `String` + - ParentId `String` + +### DescendantListResult [Api20180301Preview] + - NextLink `String` + - Value `IDescendantInfo[]` + +### DescendantParentGroupInfo [Api20180301Preview] + - Id `String` + +### DirectoryObject \ [Api16] + - DeletionTimestamp `DateTime?` **{MinValue, MaxValue}** + - ObjectId `String` + - ObjectType `String` + +### DirectoryObjectListResult [Api16] + - OdataNextLink `String` + - Value `IDirectoryObject[]` + +### Domain \ [Api16] + - AuthenticationType `String` + - IsDefault `Boolean?` + - IsVerified `Boolean?` + - Name `String` + +### DomainListResult [Api16] + - Value `IDomain[]` + +### EntityInfo [Api20180301Preview] + - DisplayName `String` + - Id `String` + - InheritedPermission `String` + - Name `String` + - NumberOfChild `Int32?` + - NumberOfChildGroup `Int32?` + - NumberOfDescendant `Int32?` + - ParentDisplayNameChain `String[]` + - ParentId `String` + - ParentNameChain `String[]` + - Permission `String` + - TenantId `String` + - Type `String` + +### EntityInfoProperties [Api20180301Preview] + - DisplayName `String` + - InheritedPermission `String` + - NumberOfChild `Int32?` + - NumberOfChildGroup `Int32?` + - NumberOfDescendant `Int32?` + - ParentDisplayNameChain `String[]` + - ParentId `String` + - ParentNameChain `String[]` + - Permission `String` + - TenantId `String` + +### EntityListResult [Api20180301Preview] + - Count `Int32?` + - NextLink `String` + - Value `IEntityInfo[]` + +### EntityParentGroupInfo [Api20180301Preview] + - Id `String` + +### ErrorDetails [Api20180301Preview] + - Code `String` + - Detail `String` + - Message `String` + +### ErrorMessage [Api16] + - Message `String` + +### ErrorResponse [Api20160901Preview, Api20180301Preview] + - ErrorCode `String` + - ErrorDetail `String` + - ErrorMessage `String` + - HttpStatus `String` + +### ExportTemplateRequest [Api20180501] + - Option `String` + - Resource `String[]` + +### FeatureOperationsListResult [Api20151201] + - NextLink `String` + - Value `IFeatureResult[]` + +### FeatureProperties [Api20151201] + - State `String` + +### FeatureResult [Api20151201] + - Id `String` + - Name `String` + - State `String` + - Type `String` + +### GenericResource [Api20160901Preview, Api20180501] + - Id `String` + - IdentityPrincipalId `String` + - IdentityTenantId `String` + - IdentityType `ResourceIdentityType?` **{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned}** + - IdentityUserAssignedIdentity `IIdentityUserAssignedIdentities ` + - Kind `String` + - Location `String` + - ManagedBy `String` + - Name `String` + - PlanName `String` + - PlanProduct `String` + - PlanPromotionCode `String` + - PlanPublisher `String` + - PlanVersion `String` + - Property `IGenericResourceProperties` + - SkuCapacity `Int32?` + - SkuFamily `String` + - SkuModel `String` + - SkuName `String` + - SkuSize `String` + - SkuTier `String` + - Tag `IResourceTags ` + - Type `String` + +### GetObjectsParameters \ [Api16] + - IncludeDirectoryObjectReference `Boolean?` + - ObjectId `String[]` + - Type `String[]` + +### GraphError [Api16] + - ErrorMessageValueMessage `String` + - OdataErrorCode `String` + +### GroupAddMemberParameters \ [Api16] + - Url `String` + +### GroupCreateParameters \ [Api16] + - DisplayName `String` + - MailEnabled `Boolean` + - MailNickname `String` + - SecurityEnabled `Boolean` + +### GroupGetMemberGroupsParameters \ [Api16] + - SecurityEnabledOnly `Boolean` + +### GroupGetMemberGroupsResult [Api16] + - Value `String[]` + +### GroupListResult [Api16] + - OdataNextLink `String` + - Value `IAdGroup[]` + +### HttpMessage [Api20180501] + - Content `IHttpMessageContent` + +### Identity [Api20160901Preview, Api20180501] + - PrincipalId `String` + - TenantId `String` + - Type `ResourceIdentityType?` **{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned}** + - UserAssignedIdentity `IIdentityUserAssignedIdentities ` + +### Identity1 [Api20180501] + - PrincipalId `String` + - TenantId `String` + - Type `ResourceIdentityType?` **{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned}** + +### InformationalUrl [Api16] + - Marketing `String` + - Privacy `String` + - Support `String` + - TermsOfService `String` + +### KeyCredential \ [Api16] + - CustomKeyIdentifier `String` + - EndDate `DateTime?` **{MinValue, MaxValue}** + - KeyId `String` + - StartDate `DateTime?` **{MinValue, MaxValue}** + - Type `String` + - Usage `String` + - Value `String` + +### KeyCredentialListResult [Api16] + - Value `IKeyCredential[]` + +### KeyCredentialsUpdateParameters [Api16] + - Value `IKeyCredential[]` + +### Location [Api20160601] + - DisplayName `String` + - Id `String` + - Latitude `String` + - Longitude `String` + - Name `String` + - SubscriptionId `String` + +### LocationListResult [Api20160601] + - Value `ILocation[]` + +### ManagementGroup [Api20180301Preview] + - Child `IManagementGroupChildInfo[]` + - DetailUpdatedBy `String` + - DetailUpdatedTime `DateTime?` **{MinValue, MaxValue}** + - DetailVersion `Single?` + - DisplayName `String` + - Id `String` + - Name `String` + - ParentDisplayName `String` + - ParentId `String` + - ParentName `String` + - Role `String[]` + - TenantId `String` + - Type `String` + +### ManagementGroupChildInfo [Api20180301Preview] + - Child `IManagementGroupChildInfo[]` + - DisplayName `String` + - Id `String` + - Name `String` + - Role `String[]` + - Type `String` + +### ManagementGroupDetails [Api20180301Preview] + - ParentDisplayName `String` + - ParentId `String` + - ParentName `String` + - UpdatedBy `String` + - UpdatedTime `DateTime?` **{MinValue, MaxValue}** + - Version `Single?` + +### ManagementGroupInfo [Api20180301Preview] + - DisplayName `String` + - Id `String` + - Name `String` + - TenantId `String` + - Type `String` + +### ManagementGroupInfoProperties [Api20180301Preview] + - DisplayName `String` + - TenantId `String` + +### ManagementGroupListResult [Api20180301Preview] + - NextLink `String` + - Value `IManagementGroupInfo[]` + +### ManagementGroupProperties [Api20180301Preview] + - Child `IManagementGroupChildInfo[]` + - DetailUpdatedBy `String` + - DetailUpdatedTime `DateTime?` **{MinValue, MaxValue}** + - DetailVersion `Single?` + - DisplayName `String` + - ParentDisplayName `String` + - ParentId `String` + - ParentName `String` + - Role `String[]` + - TenantId `String` + +### ManagementLockListResult [Api20160901] + - NextLink `String` + - Value `IManagementLockObject[]` + +### ManagementLockObject [Api20160901] + - Id `String` + - Level `LockLevel` **{CanNotDelete, NotSpecified, ReadOnly}** + - Name `String` + - Note `String` + - Owner `IManagementLockOwner[]` + - Type `String` + +### ManagementLockOwner [Api20160901] + - ApplicationId `String` + +### ManagementLockProperties [Api20160901] + - Level `LockLevel` **{CanNotDelete, NotSpecified, ReadOnly}** + - Note `String` + - Owner `IManagementLockOwner[]` + +### OAuth2Permission [Api16] + - AdminConsentDescription `String` + - AdminConsentDisplayName `String` + - Id `String` + - IsEnabled `Boolean?` + - Type `String` + - UserConsentDescription `String` + - UserConsentDisplayName `String` + - Value `String` + +### OAuth2PermissionGrant [Api16] + - ClientId `String` + - ConsentType `ConsentType?` **{AllPrincipals, Principal}** + - ExpiryTime `String` + - ObjectId `String` + - OdataType `String` + - PrincipalId `String` + - ResourceId `String` + - Scope `String` + - StartTime `String` + +### OAuth2PermissionGrantListResult [Api16] + - OdataNextLink `String` + - Value `IOAuth2PermissionGrant[]` + +### OdataError [Api16] + - Code `String` + - ErrorMessageValueMessage `String` + +### OnErrorDeployment [Api20180501] + - DeploymentName `String` + - Type `OnErrorDeploymentType?` **{LastSuccessful, SpecificDeployment}** + +### OnErrorDeploymentExtended [Api20180501] + - DeploymentName `String` + - ProvisioningState `String` + - Type `OnErrorDeploymentType?` **{LastSuccessful, SpecificDeployment}** + +### Operation [Api20151201, Api20180301Preview] + - DisplayDescription `String` + - DisplayOperation `String` + - DisplayProvider `String` + - DisplayResource `String` + - Name `String` + +### OperationDisplay [Api20151201] + - Operation `String` + - Provider `String` + - Resource `String` + +### OperationDisplayProperties [Api20180301Preview] + - Description `String` + - Operation `String` + - Provider `String` + - Resource `String` + +### OperationListResult [Api20151201, Api20180301Preview] + - NextLink `String` + - Value `IOperation[]` + +### OperationResults [Api20180301Preview] + - Id `String` + - Name `String` + - ProvisioningState `String` + - Type `String` + +### OperationResultsProperties [Api20180301Preview] + - ProvisioningState `String` + +### OptionalClaim [Api16] + - AdditionalProperty `IOptionalClaimAdditionalProperties` + - Essential `Boolean?` + - Name `String` + - Source `String` + +### OptionalClaims [Api16] + - AccessToken `IOptionalClaim[]` + - IdToken `IOptionalClaim[]` + - SamlToken `IOptionalClaim[]` + +### ParametersLink [Api20180501] + - ContentVersion `String` + - Uri `String` + +### ParentGroupInfo [Api20180301Preview] + - DisplayName `String` + - Id `String` + - Name `String` + +### PasswordCredential \ [Api16] + - CustomKeyIdentifier `Byte[]` + - EndDate `DateTime?` **{MinValue, MaxValue}** + - KeyId `String` + - StartDate `DateTime?` **{MinValue, MaxValue}** + - Value `String` + +### PasswordCredentialListResult [Api16] + - Value `IPasswordCredential[]` + +### PasswordCredentialsUpdateParameters [Api16] + - Value `IPasswordCredential[]` + +### PasswordProfile \ [Api16] + - ForceChangePasswordNextLogin `Boolean?` + - Password `String` + +### PatchManagementGroupRequest [Api20180301Preview] + - DisplayName `String` + - ParentId `String` + +### Permission [Api20150701, Api201801Preview] + - Action `String[]` + - DataAction `String[]` + - NotAction `String[]` + - NotDataAction `String[]` + +### PermissionGetResult [Api20150701, Api201801Preview] + - NextLink `String` + - Value `IPermission[]` + +### Plan [Api20160901Preview, Api20180501] + - Name `String` + - Product `String` + - PromotionCode `String` + - Publisher `String` + - Version `String` + +### PlanPatchable [Api20160901Preview] + - Name `String` + - Product `String` + - PromotionCode `String` + - Publisher `String` + - Version `String` + +### PolicyAssignment [Api20151101, Api20161201, Api20180501] + - Description `String` + - DisplayName `String` + - Id `String` + - IdentityPrincipalId `String` + - IdentityTenantId `String` + - IdentityType `ResourceIdentityType?` **{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned}** + - Location `String` + - Metadata `IPolicyAssignmentPropertiesMetadata` + - Name `String` + - NotScope `String[]` + - Parameter `IPolicyAssignmentPropertiesParameters` + - PolicyDefinitionId `String` + - Scope `String` + - SkuName `String` + - SkuTier `String` + - Type `String` + +### PolicyAssignmentListResult [Api20151101, Api20161201, Api20180501] + - NextLink `String` + - Value `IPolicyAssignment[]` + +### PolicyAssignmentProperties [Api20151101, Api20161201, Api20180501] + - Description `String` + - DisplayName `String` + - Metadata `IPolicyAssignmentPropertiesMetadata` + - NotScope `String[]` + - Parameter `IPolicyAssignmentPropertiesParameters` + - PolicyDefinitionId `String` + - Scope `String` + +### PolicyDefinition [Api20161201, Api20180501] + - Description `String` + - DisplayName `String` + - Id `String` + - Metadata `IPolicyDefinitionPropertiesMetadata` + - Mode `PolicyMode?` **{All, Indexed, NotSpecified}** + - Name `String` + - Parameter `IPolicyDefinitionPropertiesParameters` + - PolicyRule `IPolicyDefinitionPropertiesPolicyRule` + - PolicyType `PolicyType?` **{BuiltIn, Custom, NotSpecified}** + - Property `IPolicyDefinitionProperties` + - Type `String` + +### PolicyDefinitionListResult [Api20161201, Api20180501] + - NextLink `String` + - Value `IPolicyDefinition[]` + +### PolicyDefinitionProperties [Api20161201] + - Description `String` + - DisplayName `String` + - Metadata `IPolicyDefinitionPropertiesMetadata` + - Mode `PolicyMode?` **{All, Indexed, NotSpecified}** + - Parameter `IPolicyDefinitionPropertiesParameters` + - PolicyRule `IPolicyDefinitionPropertiesPolicyRule` + - PolicyType `PolicyType?` **{BuiltIn, Custom, NotSpecified}** + +### PolicyDefinitionReference [Api20180501] + - Parameter `IPolicyDefinitionReferenceParameters` + - PolicyDefinitionId `String` + +### PolicySetDefinition [Api20180501] + - Description `String` + - DisplayName `String` + - Id `String` + - Metadata `IPolicySetDefinitionPropertiesMetadata` + - Name `String` + - Parameter `IPolicySetDefinitionPropertiesParameters` + - PolicyDefinition `IPolicyDefinitionReference[]` + - PolicyType `PolicyType?` **{BuiltIn, Custom, NotSpecified}** + - Type `String` + +### PolicySetDefinitionListResult [Api20180501] + - NextLink `String` + - Value `IPolicySetDefinition[]` + +### PolicySetDefinitionProperties [Api20180501] + - Description `String` + - DisplayName `String` + - Metadata `IPolicySetDefinitionPropertiesMetadata` + - Parameter `IPolicySetDefinitionPropertiesParameters` + - PolicyDefinition `IPolicyDefinitionReference[]` + - PolicyType `PolicyType?` **{BuiltIn, Custom, NotSpecified}** + +### PolicySku [Api20180501] + - Name `String` + - Tier `String` + +### PreAuthorizedApplication [Api16] + - AppId `String` + - Extension `IPreAuthorizedApplicationExtension[]` + - Permission `IPreAuthorizedApplicationPermission[]` + +### PreAuthorizedApplicationExtension [Api16] + - Condition `String[]` + +### PreAuthorizedApplicationPermission [Api16] + - AccessGrant `String[]` + - DirectAccessGrant `Boolean?` + +### Principal [Api20180701Preview] + - Id `String` + - Type `String` + +### Provider [Api20180501] + - Id `String` + - Namespace `String` + - RegistrationState `String` + - ResourceType `IProviderResourceType[]` + +### ProviderListResult [Api20180501] + - NextLink `String` + - Value `IProvider[]` + +### ProviderOperation [Api20150701, Api201801Preview] + - Description `String` + - DisplayName `String` + - IsDataAction `Boolean?` + - Name `String` + - Origin `String` + - Property `IProviderOperationProperties` + +### ProviderOperationsMetadata [Api20150701, Api201801Preview] + - DisplayName `String` + - Id `String` + - Name `String` + - Operation `IProviderOperation[]` + - ResourceType `IResourceType[]` + - Type `String` + +### ProviderOperationsMetadataListResult [Api20150701, Api201801Preview] + - NextLink `String` + - Value `IProviderOperationsMetadata[]` + +### ProviderResourceType [Api20180501] + - Alias `IAliasType[]` + - ApiVersion `String[]` + - Location `String[]` + - Property `IProviderResourceTypeProperties ` + - ResourceType `String` + +### RequiredResourceAccess \ [Api16] + - ResourceAccess `IResourceAccess[]` + - ResourceAppId `String` + +### Resource [Api20160901Preview] + - Id `String` + - Location `String` + - Name `String` + - Tag `IResourceTags ` + - Type `String` + +### ResourceAccess \ [Api16] + - Id `String` + - Type `String` + +### ResourceGroup [Api20180501] + - Id `String` + - Location `String` + - ManagedBy `String` + - Name `String` + - ProvisioningState `String` + - Tag `IResourceGroupTags ` + - Type `String` + +### ResourceGroupExportResult [Api20180501] + - ErrorCode `String` + - ErrorDetail `IResourceManagementErrorWithDetails[]` + - ErrorMessage `String` + - ErrorTarget `String` + - Template `IResourceGroupExportResultTemplate` + +### ResourceGroupListResult [Api20180501] + - NextLink `String` + - Value `IResourceGroup[]` + +### ResourceGroupPatchable [Api20180501] + - ManagedBy `String` + - Name `String` + - ProvisioningState `String` + - Tag `IResourceGroupPatchableTags ` + +### ResourceGroupProperties [Api20180501] + - ProvisioningState `String` + +### ResourceLink [Api20160901] + - Id `String` + - Name `String` + - Note `String` + - SourceId `String` + - TargetId `String` + - Type `IResourceLinkType` + +### ResourceLinkProperties [Api20160901] + - Note `String` + - SourceId `String` + - TargetId `String` + +### ResourceLinkResult [Api20160901] + - NextLink `String` + - Value `IResourceLink[]` + +### ResourceListResult [Api20180501] + - NextLink `String` + - Value `IGenericResource[]` + +### ResourceManagementErrorWithDetails [Api20180501] + - Code `String` + - Detail `IResourceManagementErrorWithDetails[]` + - Message `String` + - Target `String` + +### ResourceProviderOperationDefinition [Api20151101] + - DisplayDescription `String` + - DisplayOperation `String` + - DisplayProvider `String` + - DisplayPublisher `String` + - DisplayResource `String` + - Name `String` + +### ResourceProviderOperationDetailListResult [Api20151101] + - NextLink `String` + - Value `IResourceProviderOperationDefinition[]` + +### ResourceProviderOperationDisplayProperties [Api20151101] + - Description `String` + - Operation `String` + - Provider `String` + - Publisher `String` + - Resource `String` + +### ResourcesIdentity [Models] + - ApplianceDefinitionId `String` + - ApplianceDefinitionName `String` + - ApplianceId `String` + - ApplianceName `String` + - ApplicationDefinitionId `String` + - ApplicationDefinitionName `String` + - ApplicationId `String` + - ApplicationId1 `String` + - ApplicationName `String` + - ApplicationObjectId `String` + - DenyAssignmentId `String` + - DeploymentName `String` + - DomainName `String` + - FeatureName `String` + - GroupId `String` + - GroupObjectId `String` + - Id `String` + - LinkId `String` + - LockName `String` + - ManagementGroupId `String` + - MemberObjectId `String` + - ObjectId `String` + - OperationId `String` + - OwnerObjectId `String` + - ParentResourcePath `String` + - PolicyAssignmentId `String` + - PolicyAssignmentName `String` + - PolicyDefinitionName `String` + - PolicySetDefinitionName `String` + - ResourceGroupName `String` + - ResourceId `String` + - ResourceName `String` + - ResourceProviderNamespace `String` + - ResourceType `String` + - RoleAssignmentId `String` + - RoleAssignmentName `String` + - RoleDefinitionId `String` + - RoleId `String` + - Scope `String` + - SourceResourceGroupName `String` + - SubscriptionId `String` + - TagName `String` + - TagValue `String` + - TenantId `String` + - UpnOrObjectId `String` + +### ResourcesMoveInfo [Api20180501] + - Resource `String[]` + - TargetResourceGroup `String` + +### ResourceType [Api20150701, Api201801Preview] + - DisplayName `String` + - Name `String` + - Operation `IProviderOperation[]` + +### RoleAssignment [Api20150701, Api20171001Preview, Api20180901Preview] + - CanDelegate `Boolean?` + - Id `String` + - Name `String` + - PrincipalId `String` + - PrincipalType `PrincipalType?` **{Application, DirectoryObjectOrGroup, DirectoryRoleTemplate, Everyone, ForeignGroup, Group, Msi, ServicePrincipal, Unknown, User}** + - RoleDefinitionId `String` + - Scope `String` + - Type `String` + +### RoleAssignmentCreateParameters [Api20150701, Api20171001Preview, Api20180901Preview] + - CanDelegate `Boolean?` + - PrincipalId `String` + - PrincipalType `PrincipalType?` **{Application, DirectoryObjectOrGroup, DirectoryRoleTemplate, Everyone, ForeignGroup, Group, Msi, ServicePrincipal, Unknown, User}** + - RoleDefinitionId `String` + +### RoleAssignmentListResult [Api20150701, Api20180901Preview] + - NextLink `String` + - Value `IRoleAssignment[]` + +### RoleAssignmentProperties [Api20150701, Api20171001Preview, Api20180901Preview] + - CanDelegate `Boolean?` + - PrincipalId `String` + - PrincipalType `PrincipalType?` **{Application, DirectoryObjectOrGroup, DirectoryRoleTemplate, Everyone, ForeignGroup, Group, Msi, ServicePrincipal, Unknown, User}** + - RoleDefinitionId `String` + +### RoleAssignmentPropertiesWithScope [Api20150701, Api20171001Preview, Api20180901Preview] + - CanDelegate `Boolean?` + - PrincipalId `String` + - PrincipalType `PrincipalType?` **{Application, DirectoryObjectOrGroup, DirectoryRoleTemplate, Everyone, ForeignGroup, Group, Msi, ServicePrincipal, Unknown, User}** + - RoleDefinitionId `String` + - Scope `String` + +### RoleDefinition [Api20150701, Api201801Preview] + - AssignableScope `String[]` + - Description `String` + - Id `String` + - Name `String` + - Permission `IPermission[]` + - RoleName `String` + - RoleType `String` + - Type `String` + +### RoleDefinitionListResult [Api20150701, Api201801Preview] + - NextLink `String` + - Value `IRoleDefinition[]` + +### RoleDefinitionProperties [Api20150701, Api201801Preview] + - AssignableScope `String[]` + - Description `String` + - Permission `IPermission[]` + - RoleName `String` + - RoleType `String` + +### ServicePrincipal \ [Api16] + - AccountEnabled `Boolean?` + - AlternativeName `String[]` + - AppDisplayName `String` + - AppId `String` + - AppOwnerTenantId `String` + - AppRole `IAppRole[]` + - AppRoleAssignmentRequired `Boolean?` + - DeletionTimestamp `DateTime?` **{MinValue, MaxValue}** + - DisplayName `String` + - ErrorUrl `String` + - Homepage `String` + - KeyCredentials `IKeyCredential[]` + - LogoutUrl `String` + - Name `String[]` + - Oauth2Permission `IOAuth2Permission[]` + - ObjectId `String` + - ObjectType `String` + - PasswordCredentials `IPasswordCredential[]` + - PreferredTokenSigningKeyThumbprint `String` + - PublisherName `String` + - ReplyUrl `String[]` + - SamlMetadataUrl `String` + - Tag `String[]` + - Type `String` + +### ServicePrincipalBase [Api16] + - AccountEnabled `Boolean?` + - AppRoleAssignmentRequired `Boolean?` + - KeyCredentials `IKeyCredential[]` + - PasswordCredentials `IPasswordCredential[]` + - ServicePrincipalType `String` + - Tag `String[]` + +### ServicePrincipalCreateParameters [Api16] + - AccountEnabled `Boolean?` + - AppId `String` + - AppRoleAssignmentRequired `Boolean?` + - KeyCredentials `IKeyCredential[]` + - PasswordCredentials `IPasswordCredential[]` + - ServicePrincipalType `String` + - Tag `String[]` + +### ServicePrincipalListResult [Api16] + - OdataNextLink `String` + - Value `IServicePrincipal[]` + +### ServicePrincipalObjectResult [Api16] + - OdataMetadata `String` + - Value `String` + +### ServicePrincipalUpdateParameters [Api16] + - AccountEnabled `Boolean?` + - AppRoleAssignmentRequired `Boolean?` + - KeyCredentials `IKeyCredential[]` + - PasswordCredentials `IPasswordCredential[]` + - ServicePrincipalType `String` + - Tag `String[]` + +### SignInName \ [Api16] + - Type `String` + - Value `String` + +### Sku [Api20160901Preview, Api20180501] + - Capacity `Int32?` + - Family `String` + - Model `String` + - Name `String` + - Size `String` + - Tier `String` + +### Subscription [Api20160601] + - AuthorizationSource `String` + - DisplayName `String` + - Id `String` + - PolicyLocationPlacementId `String` + - PolicyQuotaId `String` + - PolicySpendingLimit `SpendingLimit?` **{CurrentPeriodOff, Off, On}** + - State `SubscriptionState?` **{Deleted, Disabled, Enabled, PastDue, Warned}** + - SubscriptionId `String` + +### SubscriptionPolicies [Api20160601] + - LocationPlacementId `String` + - QuotaId `String` + - SpendingLimit `SpendingLimit?` **{CurrentPeriodOff, Off, On}** + +### TagCount [Api20180501] + - Type `String` + - Value `Int32?` + +### TagDetails [Api20180501] + - CountType `String` + - CountValue `Int32?` + - Id `String` + - TagName `String` + - Value `ITagValue[]` + +### TagsListResult [Api20180501] + - NextLink `String` + - Value `ITagDetails[]` + +### TagValue [Api20180501] + - CountType `String` + - CountValue `Int32?` + - Id `String` + - TagValue1 `String` + +### TargetResource [Api20180501] + - Id `String` + - ResourceName `String` + - ResourceType `String` + +### TemplateLink [Api20180501] + - ContentVersion `String` + - Uri `String` + +### TenantBackfillStatusResult [Api20180301Preview] + - Status `Status?` **{Cancelled, Completed, Failed, NotStarted, NotStartedButGroupsExist, Started}** + - TenantId `String` + +### TenantIdDescription [Api20160601] + - Id `String` + - TenantId `String` + +### TenantListResult [Api20160601] + - NextLink `String` + - Value `ITenantIdDescription[]` + +### User \ [Api16] + - AccountEnabled `Boolean?` + - DeletionTimestamp `DateTime?` **{MinValue, MaxValue}** + - DisplayName `String` + - GivenName `String` + - ImmutableId `String` + - Mail `String` + - MailNickname `String` + - ObjectId `String` + - ObjectType `String` + - PrincipalName `String` + - SignInName `ISignInName[]` + - Surname `String` + - Type `UserType?` **{Guest, Member}** + - UsageLocation `String` + +### UserBase \ [Api16] + - GivenName `String` + - ImmutableId `String` + - Surname `String` + - UsageLocation `String` + - UserType `UserType?` **{Guest, Member}** + +### UserCreateParameters \ [Api16] + - AccountEnabled `Boolean` + - DisplayName `String` + - GivenName `String` + - ImmutableId `String` + - Mail `String` + - MailNickname `String` + - PasswordProfile `IPasswordProfile ` + - Surname `String` + - UsageLocation `String` + - UserPrincipalName `String` + - UserType `UserType?` **{Guest, Member}** + +### UserGetMemberGroupsParameters \ [Api16] + - SecurityEnabledOnly `Boolean` + +### UserGetMemberGroupsResult [Api16] + - Value `String[]` + +### UserListResult [Api16] + - OdataNextLink `String` + - Value `IUser[]` + +### UserUpdateParameters \ [Api16] + - AccountEnabled `Boolean?` + - DisplayName `String` + - GivenName `String` + - ImmutableId `String` + - MailNickname `String` + - PasswordProfile `IPasswordProfile ` + - Surname `String` + - UsageLocation `String` + - UserPrincipalName `String` + - UserType `UserType?` **{Guest, Member}** + diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/resources/README.md b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/resources/README.md new file mode 100644 index 00000000000..937f07f8fec --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/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/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/test/README.md b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/test/README.md new file mode 100644 index 00000000000..7c752b4c8c4 --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/tools/Resources/test/README.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `..\custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/utils/Get-SubscriptionIdTestSafe.ps1 b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/utils/Get-SubscriptionIdTestSafe.ps1 new file mode 100644 index 00000000000..5319862d337 --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/utils/Get-SubscriptionIdTestSafe.ps1 @@ -0,0 +1,7 @@ +param() +if ($env:AzPSAutorestTestPlaybackMode) { + $loadEnvPath = Join-Path $PSScriptRoot '..' 'test' 'loadEnv.ps1' + . ($loadEnvPath) + return $env.SubscriptionId +} +return (Get-AzContext).Subscription.Id \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/utils/Unprotect-SecureString.ps1 b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/utils/Unprotect-SecureString.ps1 new file mode 100644 index 00000000000..cb05b51a622 --- /dev/null +++ b/tests-upgrade/tests-emitter/StorageMover.Management.brown/target/utils/Unprotect-SecureString.ps1 @@ -0,0 +1,16 @@ +#This script converts securestring to plaintext + +param( + [Parameter(Mandatory, ValueFromPipeline)] + [System.Security.SecureString] + ${SecureString} +) + +$ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) +try { + $plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ssPtr) +} finally { + [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ssPtr) +} + +return $plaintext \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/tspconfig.yaml b/tests-upgrade/tests-emitter/StorageMover.Management.brown/tspconfig.yaml similarity index 100% rename from tests-upgrade/tests-emitter/StorageMover.Management/tspconfig.yaml rename to tests-upgrade/tests-emitter/StorageMover.Management.brown/tspconfig.yaml diff --git a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/.gitignore b/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/.gitignore deleted file mode 100644 index 8b93ac42481..00000000000 --- a/tests-upgrade/tests-emitter/StorageMover.Management/target/tools/Resources/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -bin -obj -.vs -generated -internal -exports -custom/*.psm1 -custom/autogen-model-cmdlets -test/*-TestResults.xml -/*.ps1 -/*.ps1xml -/*.psm1 -/*.snk -/*.csproj -/*.nuspec \ No newline at end of file diff --git a/tests-upgrade/tests-emitter/configuration.json b/tests-upgrade/tests-emitter/configuration.json index 058a41a7170..739f8570263 100644 --- a/tests-upgrade/tests-emitter/configuration.json +++ b/tests-upgrade/tests-emitter/configuration.json @@ -24,7 +24,7 @@ "Sphere.Management", "StandbyPool.Management", "Workloads.SAPVirtualInstance.Management", - "StorageMover.Management", + "StorageMover.Management.brown", "Chaos.Management.brown", "Dashboard.Management.brown", "DataReplication.Management.brown", @@ -38,7 +38,8 @@ "Oracle.Database.Management.brown", "RecoveryServices.brown", "ServiceFabricManagedClusters.Management.brown", - "StorageAction.Management.brown" + "StorageAction.Management.brown", + "DataBox.Management.brown" ], "whiteTestListFull": [ "AppComplianceAutomation.Management", @@ -64,7 +65,7 @@ "Sphere.Management", "StandbyPool.Management", "Workloads.SAPVirtualInstance.Management", - "StorageMover.Management", + "StorageMover.Management.brown", "Chaos.Management.brown", "Dashboard.Management.brown", "DataReplication.Management.brown", @@ -78,7 +79,8 @@ "Oracle.Database.Management.brown", "RecoveryServices.brown", "ServiceFabricManagedClusters.Management.brown", - "StorageAction.Management.brown" + "StorageAction.Management.brown", + "DataBox.Management.brown" ], "blackTestList": [], "ignoreFolder": ["examples", "CompareResult"],